/* CSS Variables - Light Theme (Default) */
:root {
    --primary: #10b981;
    /* Emerald 500 */
    --primary-hover: #059669;
    /* Emerald 600 */
    --secondary: #3b82f6;
    /* Blue 500 */
    --accent: #8b5cf6;
    /* Violet 500 */

    --bg-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;

    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #64748b;
    /* Slate 500 */

    --border-color: #e2e8f0;
    /* Slate 200 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

/* Dark Theme Variables */
body.dark-mode {
    --primary: #34d399;
    /* Emerald 400 */
    --primary-hover: #10b981;
    /* Emerald 500 */
    --secondary: #60a5fa;
    /* Blue 400 */

    --bg-color: #0f172a;
    /* Slate 900 */
    --surface-color: #1e293b;
    /* Slate 800 */
    --surface-hover: #334155;
    /* Slate 700 */

    --text-primary: #f1f5f9;
    /* Slate 100 */
    --text-secondary: #94a3b8;
    /* Slate 400 */

    --border-color: #334155;
    /* Slate 700 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-medium), color var(--transition-medium);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, var(--bg-color), rgba(16, 185, 129, 0.1)), var(--bg-color);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--surface-color);
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    50% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-8px);
    }
}

.login-header {
    margin-bottom: 2.5rem;
}

.login-logo {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: inline-block;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.2));
}

.login-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.login-btn {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
    font-size: 1.1rem;
    padding: 1rem;
    border-radius: 14px;
}

.error-msg {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: -1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.hidden {
    display: none !important;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 4rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

body.dark-mode .main-header {
    background-color: rgba(15, 23, 42, 0.8);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.logo-container:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.logo-container:active {
    transform: translateY(0);
}

.logo-icon {
    font-size: 2.2rem;
    color: var(--primary);
    animation: spin 12s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.main-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.badge {
    background-color: var(--accent);
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    vertical-align: super;
}

.main-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    padding: 0.5rem;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background-color: var(--surface-hover);
    color: var(--primary);
}

/* Hero Section Redesigned */
.hero-section {
    padding: 10rem 2rem 8rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 100%;
    margin: 0 auto;
}

/* Topographical Pattern Background */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-radial-gradient(circle at 10% 10%, transparent 0, transparent 40px, rgba(16, 185, 129, 0.04) 40px, rgba(16, 185, 129, 0.04) 41px),
        repeating-radial-gradient(circle at 90% 90%, transparent 0, transparent 60px, rgba(59, 130, 246, 0.03) 60px, rgba(59, 130, 246, 0.03) 61px),
        repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 80px, rgba(139, 92, 246, 0.02) 80px, rgba(139, 92, 246, 0.02) 81px);
    opacity: 1;
    z-index: 0;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
    mask-image: linear-gradient(to bottom, black, transparent);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 900px;
    margin: 0 auto;
}

/* Badge Style */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(16, 185, 129, 0.15);
    /* Light green tint */
    color: #059669;
    /* Darker green text */
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    /* Pill shape */
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.hero-badge i {
    font-size: 1.1em;
}

/* Typography Headings */
.hero-section h2 {
    font-size: clamp(2.2rem, 8vw, 4.8rem);
    line-height: 1.05;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.04em;
    max-width: 15ch;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section p {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.4);
}

.btn-ghost {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background-color: var(--surface-hover);
    color: var(--primary);
    border-color: var(--primary);
}

/* Hero Actions & Stats */
.hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    margin-top: 2rem;
}

.stats {
    display: flex;
    gap: 2rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item i {
    color: var(--primary);
    font-size: 1.25rem;
}

/* Hero Visuals (Floating Cards) */
.hero-visual {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.floating-card {
    position: absolute;
    background: var(--surface-color);
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    border: 1px solid var(--border-color);
    animation: float 10s ease-in-out infinite;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.5s ease;
    z-index: 1;
}

body.dark-mode .floating-card {
    background: rgba(30, 41, 59, 0.8);
}

.floating-card i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.card-1 {
    top: 12%;
    left: 5%;
    animation-delay: 0s;
}

.card-1 i {
    background: #10b981;
}

.card-2 {
    bottom: 25%;
    left: 3%;
    animation-delay: 2s;
}

.card-2 i {
    background: #3b82f6;
}

.card-3 {
    top: 18%;
    right: 5%;
    animation-delay: 4s;
}

.card-3 i {
    background: #f59e0b;
}

.card-4 {
    bottom: 20%;
    right: 3%;
    animation-delay: 6s;
}

.card-4 i {
    background: #8b5cf6;
}

@media (max-width: 1400px) {
    .floating-card {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .card-1 {
        left: 2%;
    }

    .card-3 {
        right: 2%;
    }

    .card-2 {
        left: 1%;
    }

    .card-4 {
        right: 1%;
    }
}

@media (max-width: 1100px) {
    .hero-visual {
        opacity: 0.3;
        transform: scale(0.9);
    }
}

@media (max-width: 1024px) {
    .hero-visual {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .floating-card {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .floating-card i {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .card-1,
    .card-3 {
        top: 5%;
    }

    .card-2,
    .card-4 {
        bottom: 5%;
    }
}

@media (max-width: 640px) {
    .hero-visual {
        position: relative;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 2rem;
        opacity: 1;
        transform: none;
    }

    .floating-card {
        position: static;
        min-width: calc(50% - 0.5rem);
        animation: none;
        transform: none !important;
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .floating-card i {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-30px) rotate(2deg);
    }
}


/* Filters Section */
.filters-section {
    padding: 4rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.search-bar {
    position: relative;
    max-width: 800px;
    margin: 0 auto 3rem;
}

.search-bar i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.25rem;
    z-index: 10;
}

.search-bar input {
    width: 100%;
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 1.1rem;
    background-color: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

.filter-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Dynamics Grid & Cards */
.dynamics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    padding: 0 2rem 6rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dynamic-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.dynamic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.card-image-container {
    height: 200px;
    position: relative;
    overflow: hidden;
    background-color: var(--surface-hover);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.dynamic-card:hover .card-image {
    transform: scale(1.05);
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--primary);
    opacity: 0.2;
    background: linear-gradient(135deg, var(--surface-hover) 0%, var(--bg-color) 100%);
}

.card-badge-top {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

body.dark-mode .card-badge-top {
    background: rgba(30, 41, 59, 0.9);
}

.card-header {
    padding: 1.5rem 1.5rem 0.5rem;
    border: none;
    background: none;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.card-body {
    padding: 0 1.5rem 1rem;
    flex-grow: 1;
}

.card-objective {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.75rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: var(--bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

/* Detail View Specifics */
.dynamic-detail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 2000;
    overflow-y: auto;
    padding-bottom: 5rem;
    animation: fadeIn 0.3s ease;
}

#back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    width: fit-content;
}

#back-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--surface-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#back-btn i {
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.detail-content-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.detail-hero {
    height: 400px;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.detail-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 8rem;
    opacity: 0.1;
    /* Very subtle background icon */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

.detail-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6rem 3rem 2.5rem;
    /* Increased top padding for the gradient */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 1;
}

.detail-title {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0.5rem 0 0;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tag-primary {
    background: rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.5);
}

.tag-bncc {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.objective-lead {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.scientific-explanation {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.detail-section {
    margin-bottom: 2.5rem;
}

.detail-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.detail-section h3 i {
    color: var(--primary);
}

.detail-section p,
.detail-section ul,
.detail-section ol {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

.detail-body-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 3rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive Redesign */
@media (max-width: 1024px) {
    .hero-section {
        grid-template-columns: 1fr;
        padding: 6rem 2rem 4rem;
        text-align: center;
    }

    .hero-content {
        padding-right: 0;
        max-width: 800px;
        margin: 0 auto;
    }

    .hero-section h2 {
        font-size: clamp(2.25rem, 8vw, 3.5rem);
    }

    .hero-visual {
        height: 350px;
        margin-top: 3rem;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 1rem;
    }

    .logo-container h1 {
        font-size: 1.25rem;
    }

    .hero-section {
        padding: 4rem 1.5rem 3rem;
    }

    .hero-section h2 {
        font-size: 2.25rem;
        margin-bottom: 1rem;
    }

    .hero-section p {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }

    .stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .detail-header-inner {
        flex-direction: column;
        gap: 1.5rem;
    }

    .detail-container {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .detail-body-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-section h2 {
        font-size: 1.85rem;
    }

    .hero-badge {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }

    .floating-card {
        min-width: 140px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Print Styles */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
    }

    .main-header,
    .hero-section,
    .filters-section,
    .dynamics-grid,
    footer,
    #back-btn,
    .detail-actions,
    #theme-toggle,
    .login-overlay,
    #logout-btn {
        display: none !important;
    }

    .dynamic-detail {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        display: block !important;
        padding: 0 !important;
        width: 100% !important;
        background: white !important;
        overflow: visible !important;
        z-index: 99999 !important;
    }

    .detail-container {
        background: white !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        border: none !important;
    }

    .detail-body-grid {
        display: block;
    }

    .main-column,
    .side-column {
        width: 100%;
    }

    .side-column {
        margin-top: 2rem;
    }

    .detail-section {
        page-break-inside: avoid;
    }

    h2 {
        font-size: 24pt;
        color: black;
    }

    p,
    li {
        font-size: 12pt;
        color: black;
    }
}

/* --- New Features Styles --- */

/* --- Responsive & Adaptive Design --- */

/* Desktop (Min Width: 1024px) */
@media (min-width: 1024px) {
    .app-container {
        display: grid;
        grid-template-columns: 280px 1fr;
        min-height: 100vh;
    }

    .main-header {
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .sidebar {
        background: var(--surface-color);
        border-right: 1px solid var(--border-color);
        padding: 2rem 1rem;
        position: sticky;
        top: 80px;
        /* Adjust based on header height */
        height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

/* Sidebar Toggle Button (Hidden by default, visible on mobile) */
#sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Sidebar Overlay (For mobile drawer) */
.sidebar-overlay {
    display: none;
    /* Only for mobile */
}

/* Tablet & Mobile (Max Width: 1023px) */
@media (max-width: 1023px) {
    .app-container {
        display: block;
        position: relative;
    }

    #sidebar-toggle-btn {
        display: flex;
        /* Show hamburger on mobile */
    }

    /* Mobile Sidebar / Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        /* Hidden by default */
        width: 280px;
        height: 100vh;
        z-index: 2000;
        background: var(--surface-color);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
        padding-top: 1rem;
        overflow-y: auto;
    }

    .sidebar.active {
        transform: translateX(0);
        /* Slide in */
    }

    /* Overlay styles */
    .sidebar-overlay {
        display: block;
        /* Enable block display on mobile */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1500;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .sidebar-nav {
        flex-direction: column !important;
        padding: 0 1rem;
    }

    .sidebar-nav li {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .mobile-only-flex {
        display: flex !important;
        /* Force flex on mobile */
    }

    /* Adjust main content padding */
    .app-section {
        padding: 1.5rem 1rem;
    }
}

/* Hide close button on desktop */
@media (min-width: 1024px) {
    .mobile-only-flex {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Small Mobile (Max Width: 640px) */
@media (max-width: 640px) {

    /* Header Adjustments */
    .main-header {
        padding: 0.75rem 1rem;
    }

    .logo-container h1 {
        font-size: 1.1rem;
        /* Smaller but visible */
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .badge {
        display: none;
        /* Save space */
    }

    /* Nav Links: Show Icons, reduce text size if needed */
    .nav-link {
        font-size: 0;
        /* Icon only on very small screens to save header space */
        padding: 0.5rem;
    }

    .nav-link i {
        font-size: 1.4rem;
        margin: 0;
    }

    .counter {
        top: -2px;
        right: -2px;
    }

    /* Filters Section Grid */
    .filter-groups {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        align-items: end;
    }

    .filter-group {
        min-width: 0;
    }

    .filter-toggle {
        grid-column: span 2;
        width: 100%;
        justify-content: center;
        background: var(--surface-color);
        padding: 0.75rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }

    .filter-group select {
        width: 100%;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80a8,8,0,0,1,11.32-11.32L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        padding-right: 2.5rem;
    }

    /* Grid layout 1 column */
    .dynamics-grid {
        grid-template-columns: 1fr;
        padding: 0 0 4rem;
        gap: 1.5rem;
    }

    /* Hero */
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-section h2 {
        font-size: 1.8rem;
    }

    .hero-actions {
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .stats {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    /* Feature Cards Responsiveness */
    .quiz-card,
    .plan-card,
    .checklist-container,
    .prob-card,
    .emergency-card,
    .sorter-card {
        padding: 1.5rem;
        width: 100%;
        margin-top: 1rem;
        box-sizing: border-box;
        /* Ensure padding doesn't overflow */
    }

    .plan-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .checklist-item label {
        font-size: 0.9rem;
    }

    /* Detail View UI Aprimorada Mobile */
    .detail-content-wrapper {
        padding: 1rem;
    }

    .detail-hero {
        height: 320px;
        border-radius: 16px;
        margin-top: 4rem;
        /* Space for the fixed back button */
    }

    .detail-hero-overlay {
        padding: 1.5rem;
    }

    .detail-title {
        font-size: 1.8rem;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    .detail-tags {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .detail-tags .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }

    .detail-body-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .detail-section h3 {
        font-size: 1.15rem;
    }

    .detail-header-inner {
        flex-direction: column;
        gap: 0.75rem;
    }

    .detail-actions {
        width: 100%;
        gap: 0.75rem;
    }

    .detail-actions .btn {
        width: 100%;
    }

    #back-btn {
        position: fixed;
        top: 1rem;
        left: 1rem;
        width: auto;
        border-radius: 999px;
        z-index: 3000;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid var(--border-color);
        padding: 0.4rem 1rem;
        margin: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        color: var(--text-primary);
        font-size: 0.8rem;
    }

    body.dark-mode #back-btn {
        background: rgba(30, 41, 59, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }

    #back-btn:hover {
        transform: none;
        /* No horizontal move on fixed mobile bar */
        background: rgba(255, 255, 255, 0.9);
    }

    /* Login Form */
    .login-card {
        padding: 2rem 1.25rem;
        margin: 1rem;
    }

    /* Sidebar Scroll Hint */
    .sidebar::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, var(--surface-color));
        pointer-events: none;
    }
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Increased gap for better touch ability */
}

.sidebar-nav li {
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid transparent;
    /* Prevent layout shift on hover border */
    position: relative;
    overflow: hidden;
}

.sidebar-nav li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transform: scaleY(0);
    transition: transform 0.3s ease;
    opacity: 0;
}

.sidebar-nav li:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.sidebar-nav li.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, transparent 100%);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(16, 185, 129, 0.2);
}

.sidebar-nav li.active::before {
    transform: scaleY(1);
    opacity: 1;
}

.sidebar-nav li i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

.sidebar-nav li:hover i {
    transform: scale(1.1);
    color: var(--primary);
}

/* Sections */
.app-section {
    padding: 2rem;
    animation: fadeIn 0.4s ease;
}

.app-section.hidden {
    display: none;
}

/* Lesson Plan Card */
.plan-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
}

.plan-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--border-color);
}

.highlight-box {
    background: rgba(59, 130, 246, 0.05);
    /* Blue tint */
    border-left: 4px solid var(--secondary);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 12px 12px 0;
}

/* Question Bank */
.question-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.question-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.q-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    padding: 2px 8px;
    border-radius: 4px;
}

.q-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-copy {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-copy:hover {
    background: var(--bg-color);
    color: var(--primary);
}

/* Quiz */
.quiz-card {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    max-width: 600px;
    margin: 2rem auto;
    box-shadow: var(--shadow-lg);
}

.quiz-options {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.quiz-opt {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    font-weight: 600;
    transition: 0.2s;
}

.quiz-opt:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

.quiz-opt.correct {
    background: #dcfce7;
    border-color: #10b981;
    color: #047857;
}

.quiz-opt.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

/* Emergency & Sorter */
.emergency-card,
.sorter-card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 16px;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

.emer-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.emer-item i {
    font-size: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 8px;
}

/* Checklist */
.checklist-container {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.progress-track {
    background: var(--bg-color);
    height: 10px;
    border-radius: 5px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    transition: width 0.5s ease;
}

.checklist-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Prob Card */
.prob-card {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    border: 2px dashed var(--primary);
    margin-top: 2rem;
}

.prob-card h3 {
    font-size: 1.5rem;
    margin-top: 1rem;
    color: var(--text-primary);
}

.icon-lg {
    font-size: 3rem;
    color: var(--primary);
}