/* Colors taken from the crystal ball logo */
:root {
    --violet: #7C3AED;
    --violet-dark: #6D28D9;
    --violet-light: #8B5CF6;
    --indigo: #6366F1;
    --indigo-dark: #4F46E5;
    --violet-tint: #F5F3FF;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #fafafa;
}

/* Subtle dotted grid behind the card that fades out towards the edges */
body::before {
    content: "";
    position: fixed; /* Stays put while the page scrolls, also on phones */
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(rgba(15, 23, 42, 0.30) 1.1px, transparent 1.4px);
    background-size: 18px 18px;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 30%, #000 45%, transparent 100%);
    mask-image: radial-gradient(ellipse 85% 75% at 50% 30%, #000 45%, transparent 100%);
}

.page {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08);
    width: 90%;
    max-width: 500px; /* Constrain width on larger screens */
    box-sizing: border-box;
    margin: 40px auto 16px auto; /* Space above the card, and before the footer */
}

.image-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.image-box img {
    width: 220px; /* Similar to h1 width */
    height: 60px;
    max-width: 100%;
    object-fit: contain;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
    color: #555;
}

textarea,
input[type="text"],
input[type="email"],
input[type="date"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box; /* Ensure consistent sizing */
    resize: none; /* Prevent resizing of textareas */
}

.note {
    font-size: 12px;
    color: #777;
    margin-top: 1px;
    margin-bottom: 5px; /* Add spacing after the note */
}

button {
    width: 100%;
    padding: 10px 15px;
    background-color: var(--violet);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:disabled {
    background-color: #ccc;
}

button:hover {
    background-color: var(--violet-dark);
}

/* Action buttons (Submit, Email me a sign-in link): same family as the section headers, but a
   violet-to-indigo gradient so they read as actions rather than section bars */
#submitButton,
.signin-button {
    background-image: linear-gradient(135deg, var(--violet-light), var(--indigo));
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

#submitButton:hover,
.signin-button:hover {
    background-image: linear-gradient(135deg, var(--violet), var(--indigo-dark));
}

#submitButton:disabled,
.signin-button:disabled {
    background-image: none;
    box-shadow: none;
}

.error {
    color: red;
    margin-bottom: 10px;
    font-size: 12px;
    text-align: left;
}

.form-group button:hover {
    background-color: #2e7d32;
}

.page-footer {
    margin: 0 auto 24px auto;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

/* Signed-in account line under the title */
.account {
    text-align: center;
    font-size: 13px;
    color: #555;
    margin: -10px 0 15px 0;
}

.link-button,
.link-button:hover {
    width: auto;
    padding: 0;
    background: none;
    color: var(--violet);
    font-size: 13px;
    font-weight: normal;
    text-decoration: underline;
}

/* Collapsible sections: each header is a one-row blue bar like the Submit button */
.panel + .panel {
    margin-top: 12px;
}

.panel-heading {
    margin: 0;
    font-size: inherit;
}

.panel-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.panel-title {
    flex: 1;
}

.badge {
    min-width: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.25);
    font-size: 13px;
    text-align: center;
    box-sizing: border-box;
}

.chevron {
    width: 8px;
    height: 8px;
    margin: 0 4px 4px 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg); /* Points down when the section is open */
    transition: transform 0.2s ease;
}

.panel-toggle[aria-expanded="false"] .chevron {
    transform: rotate(-45deg); /* Points right when the section is closed */
    margin-bottom: 0;
}

.panel-body {
    padding: 15px 2px 5px 2px;
}

/* Sign-in form shown in the list sections when signed out */
.signin .note {
    margin-bottom: 10px;
}

/* Prediction lists: one compact row per prediction, tap to see the details */
.predictions {
    list-style: none;
    margin: 0;
    padding: 0;
}

.prediction + .prediction {
    border-top: 1px solid #eee;
}

.prediction-row,
.prediction-row:hover {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 4px;
    background: none;
    color: #333;
    font-size: 14px;
    font-weight: normal;
    text-align: left;
    border-radius: 0;
}

.prediction-row:hover {
    background-color: var(--violet-tint);
}

.prediction-date {
    flex: 0 0 auto;
    min-width: 52px;
    font-weight: bold;
    color: var(--violet);
}

.prediction-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.prediction-chevron {
    color: #999;
    transition: transform 0.2s ease;
}

.prediction-row[aria-expanded="true"] .prediction-chevron {
    transform: rotate(90deg);
}

.prediction-details {
    padding: 0 4px 12px 68px;
    font-size: 13px;
    color: #555;
}

.prediction-content {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.prediction-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 0;
}

.prediction-facts dt {
    font-weight: bold;
    color: #777;
}

.prediction-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.empty {
    margin: 5px 0 10px 0;
    font-size: 14px;
    color: #777;
    text-align: center;
}

/* Phones: use almost the whole screen width for the card */
@media (max-width: 480px) {
    .page {
        width: auto;
        margin: 12px;
        padding: 16px;
    }
}

@media (max-width: 400px) {
    .prediction-details {
        padding-left: 4px;
    }
}

/* Popup container */
.popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 300px;
    font-family: Arial, sans-serif;
    animation: fadeIn 0.3s ease-in-out;
}

/* Popup background types */
.popup.info {
    background-color: #e0f7fa; /* Light blue for info */
    color: #00796b;
}
.popup.warning {
    background-color: #fff8e1; /* Light yellow for warnings */
    color: #f57c00;
}
.popup.error {
    background-color: #ffebee; /* Light red for errors */
    color: #b71c1c;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Close button */
.popup .close-btn {
    width: auto;
    padding: 0;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    color: inherit;
    float: right;
    cursor: pointer;
    margin-right: -10px;
    margin-top: -10px;
}
