/* style.css -- component styles. Colours come from static/css/theme.css,
   which must be loaded first so these tokens resolve for both themes. */

body {
    margin-bottom: 50px;
    /* Canvas (background/colour) is owned by theme.css. */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-section {
    padding: 20px 0 30px;
    text-align: center;
    background: transparent;
    animation: fadeInUp 0.8s ease-out;
}

.hero-icon {
    width: 270px;
    height: auto;
    border-radius: 24px;
    margin-bottom: 25px;
    filter: var(--hero-shadow) var(--raster-art-filter);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-icon:hover {
    transform: translateY(-10px) rotate(2deg) scale(1.1);
}

.gradient-text {
    background: var(--gradient-text);
    background-size: 300% 300%;
    animation: gradientShift 8s ease infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.03em;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.intro-container {
    max-width: 1100px;
    margin: -40px auto 40px;
    position: relative;
    z-index: 10;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.intro-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 50px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 50px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.info-box {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.info-box:hover {
    box-shadow: var(--shadow-xs);
    border-color: var(--google-blue);
    transform: translateY(-2px);
}

.info-box h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--heading);
}

.template-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.template-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: var(--surface-muted);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-subtle);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.template-item:hover {
    background: var(--template-hover-bg);
    color: var(--google-blue);
    border-color: var(--template-hover-border);
}

.template-icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

.title-text {
    margin-top: 20px;
}

/* Overlay to darken the background */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* ------------------------------ */
/* Upload progress modal          */
/* ------------------------------ */
.upload-modal {
    background: var(--surface);
    padding: 48px 44px;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    max-width: 440px;
    width: 90%;
    animation: fadeInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.upload-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gradient);
    color: #fff;
    font-size: 1.8rem;
    box-shadow: 0 0 0 0 var(--pulse-ring);
    animation: uploadPulse 2s ease-out infinite;
}

@keyframes uploadPulse {
    0% {
        box-shadow: 0 0 0 0 var(--pulse-ring);
    }

    70% {
        box-shadow: 0 0 0 16px var(--pulse-ring-fade);
    }

    100% {
        box-shadow: 0 0 0 0 var(--pulse-ring-fade);
    }
}

.upload-modal-title {
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 8px;
}

.upload-modal-subtext {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 28px;
}

.upload-progress-track {
    width: 100%;
    height: 10px;
    border-radius: 6px;
    background: var(--surface-track);
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--brand-gradient-h);
    transition: width 0.3s ease;
    position: relative;
}

.upload-progress-track.is-indeterminate .upload-progress-fill {
    width: 40% !important;
    position: absolute;
    animation: uploadIndeterminate 1.4s ease-in-out infinite;
}

@keyframes uploadIndeterminate {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}

.upload-progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-subtle);
}

.upload-modal-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.upload-modal-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.upload-modal-security {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--success-strong);
    background: var(--success-surface);
    border: 1px solid var(--success-border);
    padding: 6px 14px;
    border-radius: 20px;
}

#loading-bar-container {
    width: 50%;
    /* Adjust the width as needed */
    background-color: var(--surface-sunken);
    border-radius: 5px;
    margin: 20px auto;
    /* Center horizontally */
    position: fixed;
    /* Fix position to center on screen */
    top: 50%;
    /* Center vertically */
    left: 50%;
    /* Center horizontally */
    transform: translate(-50%, -50%);
    /* Adjust position to center */
    z-index: 1000;
    /* Ensure it is on top of other elements */
    padding: 10px;
    /* Add some padding */
    box-shadow: var(--shadow-xs);
    /* Optional: Add a shadow for better visibility */
}

#loading-bar {
    width: 0;
    height: 100px;
    /* Increase height */
    background-color: var(--google-green);
    text-align: center;
    line-height: 100px;
    /* Match the height */
    color: white;
    border-radius: 5px;
}

/* Input Glow Effect */
input.form-control,
input.input {
    transition: box-shadow 0.3s ease-in-out, border-color 0.3s;
    border: 1px solid var(--input-border);
    /* Default border */
}

input.form-control:hover {
    border-color: var(--input-border-hover);
}

input.form-control:focus,
input.input:focus {
    box-shadow: 0 0 10px var(--focus-ring);
    /* Gentle blue glow */
    border-color: var(--input-border-focus);
    outline: none;
}

.upload_card {
    background-color: var(--surface);
    padding: 40px;
    margin-top: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

/* Valid Card State */
.card-valid {
    border-color: var(--valid-border) !important;
    /* Success Green */
    box-shadow: 0 0 15px var(--valid-glow) !important;
    /* Green Glow */
}

/* Invalid Card State */
.card-invalid {
    border-color: var(--invalid-border) !important;
    /* Danger Red */
    box-shadow: 0 0 15px var(--invalid-glow) !important;
    /* Red Glow */
}

/* Centered input section (The narrower card) */
.input-section-centered {
    max-width: 600px;
    /* Narrower width */
    margin: 0 auto;
    text-align: left;
    /* Shift to left alignment */
}

/* Data Validation Card (The wide card) */
.data-validation-card {
    width: 100%;
    margin-top: 25px;
    text-align: left;
    display: none;
    /* Hidden by default until content is added */
}

/* Validation Success Message */
.validation-success {
    color: var(--success-text);
    font-weight: 500;
    margin-top: 20px;
    padding: 24px;
    background-color: var(--success-surface);
    border: 1px solid var(--success-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-xs);
}

.success-stat-pill {
    display: inline-block;
    background-color: var(--success-pill-bg);
    padding: 5px 10px;
    border-radius: 15px;
    margin: 0 5px;
    font-size: 0.9em;
    border: 1px solid var(--success-pill-border);
    color: var(--success-pill-text);
}

.upload-message {
    border: 1px solid var(--danger-border);
    padding: 24px;
    margin-top: 40px;
    border-radius: 20px;
    background-color: var(--danger-surface);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.upload-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--google-red);
}

.upload-message ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.upload-message li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    color: var(--danger-text);
    font-weight: 500;
}

.upload-message li::before {
    content: '\F333';
    /* Bootstrap Icon check-circle */
    font-family: 'bootstrap-icons';
    margin-right: 12px;
    font-size: 1.1rem;
}

.btn-premium {
    background: var(--brand-gradient);
    border: none;
    color: white;
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px var(--accent-glow-strong);
    color: white;
}

.btn-premium:active {
    transform: translateY(-1px);
}

.btn-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-premium:hover::after {
    left: 100%;
}

.upload-footer {
    margin-top: 60px;
    padding: 30px;
    background: var(--surface-sunken);
    border-radius: 20px;
    border: 1px dashed var(--border-dashed);
    text-align: center;
}

.upload-footer p {
    margin-bottom: 8px;
    color: var(--text-faint);
    font-size: 0.95rem;
}

.upload-footer .timer-icon {
    font-size: 1.2rem;
    color: var(--google-blue);
    margin-right: 8px;
}

.form-label {
    padding-bottom: 15px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--heading);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Left align the titles */
    gap: 12px;
}

.section-badge {
    background: var(--accent-solid);
    color: var(--on-accent);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.file-help {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 15px;
    padding: 16px;
    background: var(--surface-muted);
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.template-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.template-link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Program Choice Buttons */
.program-choice-btn {
    padding: 2.5rem;
    margin: 1.5rem auto;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-radius: 24px;
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
    overflow: hidden;
}

.program-choice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: var(--hairline-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background 0.4s;
}

.program-choice-btn:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-accent);
}

.program-choice-btn:hover::before {
    background: var(--hairline-gradient-hover);
}

.program-choice-btn img {
    max-height: 70px;
    width: auto;
    margin-bottom: 20px;
    transition: transform 0.4s;
}

.program-choice-btn:hover img {
    transform: scale(1.05);
}

.program-choice-btn small {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--heading);
    letter-spacing: -0.01em;
}

.energiize-btn,
.communities-btn {
    /* Removed specific background variables to allow shared white theme */
    background-color: var(--surface);
    border: none;
}

.table-responsive {
    position: relative;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    border: 1px solid var(--border-strong);
    /* Add outer border to table area */
    border-radius: 5px;
    max-height: 500px;
    /* Optional: limit height if it gets too tall */
    overflow-y: auto;
}

/* Distinct Column Table Styles */
.table-preview {
    margin-bottom: 0;
}

.table-preview th {
    background-color: var(--surface-sunken);
    /* Light grey header */
    color: var(--heading);
    border-bottom: 2px solid var(--border-stronger);
    border-right: 1px solid var(--border-strong);
    /* Vertical separator */
    padding: 12px 15px;
    white-space: nowrap;
    /* Prevent headers from wrapping awkwardly */
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-preview td {
    border-right: 1px solid var(--border);
    /* Vertical separator for data */
    padding: 10px 15px;
    vertical-align: middle;
    white-space: nowrap;
    /* Prevent data wrapping */
}

.table-preview tr:last-child td {
    border-bottom: none;
}

.scroll-hint {
    font-size: 0.85rem;
    color: var(--text-faint);
    margin-top: 8px;
    display: block;
    text-align: right;
    font-style: italic;
    background-color: var(--surface-muted);
    padding: 5px 10px;
    border-radius: 4px;
}

/* Bigger Validation Errors */
.validation-error-alert {
    background-color: var(--danger-surface);
    border: 1px solid var(--danger-border-strong);
    border-left: 5px solid var(--danger-accent);
    /* Stronger left border */
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    margin-top: 16px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.3s ease-out;
}

.validation-error-alert:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.validation-error-alert strong {
    display: flex;
    align-items: center;
    color: var(--danger-text);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.validation-error-alert strong::before {
    content: '\F332';
    /* Bootstrap exclamation-circle */
    font-family: 'bootstrap-icons';
    margin-right: 8px;
    font-size: 1rem;
}

.validation-error-msg {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 8px;
}

.validation-error-meta {
    display: inline-flex;
    align-items: center;
    background-color: var(--danger-meta-bg);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--danger-border);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-subtle);
}

.validation-error-meta i {
    color: var(--text-muted);
    margin-right: 6px;
}
