/* ===================================
   Center for Social Media and Youth
   Main Stylesheet
   =================================== */

/* === CSS Variables === */
:root {
    /* Colors */
    --color-primary: #0F9ED5;
    --color-primary-dark: #0B7AA8;
    --color-secondary: #FF8C42;
    --color-accent-green: #4CAF50;
    --color-warning: #FFA726;
    --color-alert: #EF5350;

    /* Neutrals */
    --color-text: #2C3E50;
    --color-text-light: #7F8C8D;
    --color-bg: #FFFFFF;
    --color-bg-light: #F8F9FA;
    --color-bg-dark: #E8ECEF;
    --color-border: #DEE2E6;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

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

ul, ol {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-lg);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.section {
    padding: 5rem 0;
}

.section-light {
    background-color: var(--color-bg-light);
}

.section-dark {
    background-color: var(--color-bg-dark);
}

.section-accent {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
}

.section-primary {
    background: var(--color-primary);
    color: white;
}

.section-primary h2,
.section-primary h3,
.section-primary h4 {
    color: white;
}

/* Content width constraint for better readability */
.section > .container > h2 {
    margin-bottom: 2.5rem;
}

.section > .container > p {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* === Header === */
.site-header {
    background-color: var(--color-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--spacing-sm) 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.site-logo:hover {
    text-decoration: none;
    opacity: 0.8;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: var(--spacing-lg);
    padding: 0;
    margin: 0;
}

.main-nav a {
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
}

.main-nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* === Hero Section === */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 5rem 0 6rem;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-lg);
    font-weight: 700;
    line-height: 1.1;
}

.hero p {
    font-size: 1.35rem;
    max-width: 700px;
    margin: 0 auto var(--spacing-xl);
    opacity: 0.95;
    line-height: 1.6;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    gap: var(--spacing-sm);
    background: white;
    padding: var(--spacing-xs);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.search-box input {
    flex: 1;
    border: none;
    padding: var(--spacing-sm);
    font-size: 1rem;
    outline: none;
    border-radius: var(--radius-md);
}

.search-box button {
    background: var(--color-secondary);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: #E67935;
}

/* === Mobile Menu Toggle (Hamburger) === */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle span {
    width: 2rem;
    height: 0.25rem;
    background: var(--color-text);
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    transform-origin: 1px;
    pointer-events: none; /* Prevent spans from intercepting clicks */
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Search Autocomplete Dropdown */
.search-box {
    position: relative;
}

.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-autocomplete.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.search-result {
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background-color: #f8fbfd;
}

.search-result-name {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.search-result-name strong {
    color: var(--color-primary);
}

.search-result-desc {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.search-no-results {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #E67935;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* === Cards === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--color-border);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.card h3 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

.card-link {
    color: var(--color-text);
    text-decoration: none;
    display: block;
}

.card-link:hover {
    text-decoration: none;
}

/* === Rating Badges === */
.age-badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

.rating-badge.supports {
    background: var(--color-accent-green);
    color: white;
}

.rating-badge.awareness {
    background: var(--color-warning);
    color: white;
}

.rating-badge.concerns {
    background: var(--color-alert);
    color: white;
}

/* === Rating Bars === */
.rating-dimension {
    margin-bottom: var(--spacing-md);
}

.rating-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.rating-bar {
    width: 100%;
    height: 30px;
    background: var(--color-bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.rating-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-green) 0%, var(--color-warning) 50%, var(--color-alert) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--spacing-sm);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.rating-fill.low { background: var(--color-accent-green); }
.rating-fill.medium { background: var(--color-warning); }
.rating-fill.high { background: var(--color-alert); }

/* === Feature Grid === */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    margin: 2rem 0;
}

.feature {
    text-align: center;
    padding: 1.5rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.feature h3 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

/* === Notice Boxes === */
.notice {
    padding: 2rem;
    border-radius: var(--radius-md);
    margin: var(--spacing-lg) 0;
    border-left: 4px solid;
}

.notice-info {
    background: #E3F2FD;
    border-color: var(--color-primary);
    color: #0D47A1;
}

.notice-success {
    background: #E8F5E9;
    border-color: var(--color-accent-green);
    color: #1B5E20;
}

.notice-warning {
    background: #FFF3E0;
    border-color: var(--color-warning);
    color: #E65100;
}

.notice-alert {
    background: #FFEBEE;
    border-color: var(--color-alert);
    color: #B71C1C;
}

.notice h4 {
    margin-top: 0;
    font-weight: 700;
}

/* === Budget Chart === */
.budget-chart {
    margin: var(--spacing-lg) 0;
}

.budget-item {
    margin-bottom: var(--spacing-lg);
}

.budget-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.budget-bar {
    width: 100%;
    height: 40px;
    background: var(--color-bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.budget-fill {
    height: 100%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-sm);
    color: white;
    font-weight: 600;
    transition: width 0.5s ease;
}

.budget-fill.revenue { background: var(--color-accent-green); }
.budget-fill.expense { background: var(--color-primary); }

/* === Newsletter === */
.newsletter {
    background: var(--color-bg-dark);
    padding: 3rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: var(--spacing-xl) 0;
}

.newsletter h3 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-sm);
}

.newsletter p {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
}

.newsletter-form {
    display: flex;
    gap: var(--spacing-sm);
    max-width: 500px;
    margin: var(--spacing-md) auto 0;
}

.newsletter-form input {
    flex: 1;
    padding: 0.875rem var(--spacing-sm);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.newsletter-form button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* === Footer === */
.site-footer {
    background: var(--color-text);
    color: white;
    padding: var(--spacing-xl) 0 var(--spacing-md);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.footer-section h4 {
    color: white;
    margin-bottom: var(--spacing-sm);
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section li {
    margin-bottom: var(--spacing-xs);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* === Review Page Specific === */
.review-header {
    background: var(--color-bg-light);
    padding: var(--spacing-xl) 0;
}

.review-meta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    align-items: center;
    margin: var(--spacing-md) 0;
}

.review-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

.review-sidebar {
    background: var(--color-bg-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    position: sticky;
    top: 80px;
}

.conversation-starters {
    background: var(--color-bg-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin: var(--spacing-lg) 0;
}

.conversation-starters ul {
    list-style: none;
    padding: 0;
}

.conversation-starters li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.conversation-starters li:last-child {
    border-bottom: none;
}

.conversation-starters li:before {
    content: "💬 ";
    margin-right: var(--spacing-xs);
}

/* === Enhanced Content Sections === */
.content-section {
    max-width: 900px;
    margin: 0 auto;
}

.content-section-narrow {
    max-width: 700px;
    margin: 0 auto;
}

/* Numbered list enhancements (inspired by anxiousgeneration.com) */
.numbered-list {
    list-style: none;
    counter-reset: item;
    padding: 0;
}

.numbered-list > li {
    counter-increment: item;
    margin-bottom: 2rem;
    position: relative;
    padding-left: 4rem;
}

.numbered-list > li:before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--color-primary);
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Position header for absolute nav */
    .site-header {
        position: relative;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* Mobile navigation - hidden by default */
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, box-shadow 0.3s ease;
        box-shadow: none;
        z-index: 9;
    }

    /* Mobile navigation - active state */
    .main-nav.active {
        max-height: 500px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .main-nav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        text-align: left;
        border-bottom: 1px solid #f0f0f0;
    }

    .main-nav ul li:last-child a {
        border-bottom: none;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        flex-direction: column;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Intermediate breakpoint for small tablets/large phones */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .section {
        padding: 3rem 0;
    }

    .hero {
        padding: 3rem 0 4rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .card, .notice {
        padding: 1.5rem;
    }

    /* Smaller hamburger on very small screens */
    .mobile-menu-toggle {
        width: 1.75rem;
        height: 1.75rem;
    }

    .mobile-menu-toggle span {
        width: 1.75rem;
        height: 0.2rem;
    }

    /* Full-width buttons on mobile */
    .search-box button,
    .newsletter-form button {
        width: 100%;
        min-height: 48px;
    }

    /* Improve touch targets */
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
    }

    .toast-close {
        font-size: 1.5rem;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* === Utility Classes === */

/* Text Alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Margins */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.my-1 { margin-top: var(--spacing-sm); margin-bottom: var(--spacing-sm); }
.my-2 { margin-top: var(--spacing-md); margin-bottom: var(--spacing-md); }
.my-3 { margin-top: var(--spacing-lg); margin-bottom: var(--spacing-lg); }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Max Width Utilities */
.max-w-700 { max-width: 700px; }
.max-w-800 { max-width: 800px; }
.max-w-900 { max-width: 900px; }

/* Font Sizes */
.fs-small { font-size: 0.85rem; }
.fs-normal { font-size: 1rem; }
.fs-medium { font-size: 1.05rem; }
.fs-large { font-size: 1.1rem; }
.fs-larger { font-size: 1.15rem; }
.fs-xlarge { font-size: 1.2rem; }

/* Line Height */
.lh-normal { line-height: 1.6; }
.lh-relaxed { line-height: 1.8; }

/* Display */
.d-block { display: block; }
.d-inline-block { display: inline-block; }

/* Width */
.w-full { width: 100%; }

/* Spacing */
.mr-1 { margin-right: var(--spacing-sm); }

/* Colors */
.text-muted { color: var(--color-text-light); }
.text-alert { color: var(--color-alert); }

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
}

.toast {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    animation: slideIn 0.3s ease;
    transition: var(--transition);
}

.toast.success { border-left-color: var(--color-accent-green); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.error { border-left-color: var(--color-alert); }

.toast-content {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--color-text-light);
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: var(--color-text);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
