@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --background: #121212;
    --surface: #1E1E1E;
    --primary: #6A11CB;
    --secondary: #2575FC;
    --text-primary: #E0E0E0;
    --text-secondary: #A0A0A0;
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Reset / Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 3rem 1rem;
    overflow-y: auto; /* Allow vertical scrolling when content exceeds the screen */
}

main {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    z-index: 1;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 1.5rem;
}

section {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

section h2 {
    text-align: center;
}

/* -----------------------
   Title container & logo
   ----------------------- */

/* Re-styled to make logo larger, centered and balanced with the title */
.title-container {
    display: flex;
    align-items: center;
    justify-content: center; /* Centers horizontally within the section */
    gap: 1rem;
    margin-bottom: 1.5rem; /* Adds space below the logo/title */
    /* Add padding to the right to offset the logo and center the title text */
    padding-right: 100px;
}

/* Larger logo size, keep aspect, subtle rounded corners and breathing animation */
.title-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 12px;
    animation: breathing 5s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.title-container h2 {
    font-size: 2.25rem; /* Slightly larger to match logo proportion */
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: gradient-flow 4s linear infinite;
}

/* Raining Likes Animation */
#likes-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.like {
    position: absolute;
    font-size: 1.5rem;
    color: var(--primary);
    animation: fall 10s linear infinite;
    opacity: 0;
}

@keyframes fall {
    0% {
        transform: translateY(-10vh);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(110vh);
        opacity: 0;
    }
}


/* Downloader Section */
#downloader form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#downloader input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 1rem;
    transition: box-shadow 0.3s, border-color 0.3s;
}

#downloader input::placeholder {
    color: var(--text-secondary);
}

#downloader input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.3);
}

#downloader button {
    padding: 0.875rem 1rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    background-size: 200% 100%;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: gradient-flow 4s linear infinite;
}

@keyframes gradient-flow {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

#downloader button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 117, 252, 0.3);
}

#downloader button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: none;
    animation: none;
}

/* Progress Bar */
#progress-container {
    margin-top: 1.5rem;
}

#progress-bar {
    width: 100%;
    background-color: var(--background);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
}

#progress {
    width: 0%;
    height: 0.75rem;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 6px;
    transition: width 0.4s ease-in-out;
}

#status {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Schedule Section */
#schedule-section table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

#schedule-section th, #schedule-section td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#schedule-section th {
    font-weight: 600;
    color: var(--text-primary);
}

#schedule-section td {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#schedule-section tbody tr:last-child td {
    border-bottom: none;
}

/* Caption Templates */
#caption-templates > p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.caption-item {
    background-color: var(--background);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.caption-item p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    width: 100%;
}

.caption-item button {
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.3s;
    margin-top: 1.5rem; /* Increased margin-top */
    align-self: flex-end; /* Aligns button to the right */
}

.caption-item button:hover {
    background-color: var(--primary);
}

/* Statistics Section */
#stats-section .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    text-align: center;
}

#stats-section .stat-item h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

#stats-section .stat-item p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}


/* Responsive: stack logo/title on narrow screens */
@media (max-width: 480px) {
    .title-container {
        flex-direction: column;
        gap: 0.75rem;
        padding-right: 0;
    }

    .title-logo {
        width: 80px;
        height: 80px;
    }

    .title-container h2 {
        font-size: 1.8rem;
    }
}

/* Responsive Table for Mobile */
@media (max-width: 768px) {
    #schedule-section table, 
    #schedule-section thead, 
    #schedule-section tbody, 
    #schedule-section th, 
    #schedule-section td, 
    #schedule-section tr {
        display: block;
    }

    #schedule-section thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    #schedule-section tr {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    #schedule-section td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    #schedule-section td:before {
        position: absolute;
        top: 50%;
        left: 1rem;
        transform: translateY(-50%);
        width: 45%;
        padding-right: 1rem;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-primary);
    }

    /* Add data labels */
    #schedule-section td:nth-of-type(1):before { content: "Day"; }
    #schedule-section td:nth-of-type(2):before { content: "Best Time #1"; }
    #schedule-section td:nth-of-type(3):before { content: "Best Time #2"; }
    #schedule-section td:nth-of-type(4):before { content: "Why"; }

    #schedule-section tbody tr:last-child td:last-child {
        border-bottom: none;
    }
}

/* Disclaimer Section */
#disclaimer-section {
    background-color: rgba(106, 17, 203, 0.05);
    border: 1px solid rgba(106, 17, 203, 0.2);
}

#disclaimer-section h3 {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

#disclaimer-section p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

/* Legal Pages */
.legal-page {
    max-width: 900px;
    margin: 40px auto;
    padding: 2.5rem;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.legal-page h1 {
    color: #FFFFFF;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
}

.legal-page > p:first-of-type {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.legal-page h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.legal-page h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-page p {
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.legal-page ul, .legal-page ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-page li {
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.legal-page strong {
    color: var(--text-primary);
    font-weight: 600;
}

.legal-page a {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.legal-page a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.highlight {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.highlight strong {
    color: #ffc107;
}

.back-link {
    display: inline-block;
    margin-top: 2.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.back-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 117, 252, 0.3);
    text-decoration: none;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin: 0.5rem 0;
}

footer a {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}
