/* --- GLOBAL RESPONSIVE DEFAULTS --- */
img,
video,
iframe,
canvas {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a73e8;
    /* Main Blue */
    --secondary-color: #4285f4;
    /* Lighter Blue */
    --bg-color: #f0f8ff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-color: #2d3436;
    --shadow: 0 10px 40px -10px rgba(26, 115, 232, 0.2);
}

html,
body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Prompt', 'Outfit', sans-serif;
    background: #f8f9fd;
    color: var(--text-color);
    min-height: 100vh;
    letter-spacing: -0.2px;
    padding-top: 85px;
    /* Add padding for fixed navbar */
}

.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eaf2fd 0%, #ffffff 100%);
    z-index: -1;
}

/* --- NAVBAR ENHANCEMENTS --- */
.logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    width: 40px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
    transition: transform 0.3s;
}

.logo-link:hover .logo-img {
    transform: scale(1.05) rotate(-5deg);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-main {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--primary-color);
}

.logo-sub {
    font-size: 0.7rem;
    font-weight: 400;
    color: #636e72;
}

.profile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(108, 92, 231, 0.08);
    padding: 6px 14px;
    border-radius: 50px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    border: 1px solid rgba(108, 92, 231, 0.1);
}

.profile-nav-link:hover {
    background: rgba(108, 92, 231, 0.15);
    transform: translateY(-2px);
}

.nav-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.nav-user-info {
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- FOOTER ENHANCEMENTS --- */
.glass-footer {
    margin-top: 5rem;
    padding: 3rem 1.5rem;
    color: #636e72;
    font-size: 0.9rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    text-align: center;
    position: relative;
    z-index: 100;
}

.footer-brand {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.footer-school {
    font-weight: 400;
    color: #444;
}

.footer-name {
    font-weight: 600;
    color: #2d3436;
    margin-top: 8px;
    font-size: 1rem;
}

/* Base Styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 2000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.scrolled {
    padding: 0.5rem 2rem;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.logo {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white !important;
    border-radius: 8px;
    transition: transform 0.2s;
}

/* --- THEME ENGINE 2.0 --- */

/* 1. Ocean: Dynamic Waves */
body.theme-ocean {
    --primary-color: #00a8ff;
    --secondary-color: #00d2ff;
    background: linear-gradient(180deg, #f0f8ff 0%, #d1e9ff 100%);
}

body.theme-ocean .mesh-gradient {
    background: radial-gradient(at 50% 0%, rgba(0, 168, 255, 0.1) 0px, transparent 50%);
}

/* 2. Forest: Nature Shadows */
body.theme-forest {
    --primary-color: #27ae60;
    --secondary-color: #2ecc71;
    background: #f1f8f4;
}

body.theme-forest .card {
    border-left: 5px solid var(--primary-color);
}

/* 3. Sunset: Warm Radiance */
body.theme-sunset {
    --primary-color: #e67e22;
    --secondary-color: #f1c40f;
    background: #fffaf0;
}

body.theme-sunset h1,
body.theme-sunset h2 {
    background: linear-gradient(to right, #e67e22, #f39c12);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 4. Cyberpunk: Neon Glitch */
body.theme-cyber {
    --primary-color: #ff00ff;
    --secondary-color: #00ffff;
    --bg-color: #0d0221;
    background: #0d0221 !important;
    color: #00ffff;
}

body.theme-cyber .card {
    background: rgba(20, 10, 40, 0.8);
    border: 1px solid #ff00ff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.2);
}

body.theme-cyber .navbar {
    background: rgba(13, 2, 33, 0.9);
    border-bottom: 2px solid #00ffff;
}

/* 5. Midnight: Elegant Gold */
body.theme-midnight {
    --primary-color: #d4af37;
    --secondary-color: #2c3e50;
    background: #0f172a !important;
    color: #e2e8f0;
}

body.theme-midnight .card {
    background: #1e293b;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

body.theme-midnight .logo a {
    color: #d4af37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* --- NEW 5 THEMES --- */

/* 6. Sakura: Floating Petals */
body.theme-sakura {
    --primary-color: #ff80ab;
    --secondary-color: #fce4ec;
    background: #fff5f8;
}

body.theme-sakura .navbar {
    background: rgba(255, 245, 248, 0.9);
}

body.theme-sakura .btn-submit {
    background: #ff80ab;
    box-shadow: 0 4px 15px rgba(255, 128, 171, 0.4);
}

/* 7. Galaxy: Star Gazing */
body.theme-galaxy {
    --primary-color: #9c27b0;
    --secondary-color: #3f51b5;
    background: #020617 !important;
    color: #f8fafc;
}

body.theme-galaxy .mesh-gradient {
    background: radial-gradient(circle at 20% 30%, rgba(156, 39, 176, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(63, 81, 181, 0.15) 0%, transparent 40%);
}

body.theme-galaxy .card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 8. Lava: Volcanic Pulse */
body.theme-lava {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
    background: #1a0a0a !important;
    color: #ff7675;
}

body.theme-lava .card {
    background: #2d1313;
    border-bottom: 3px solid #e74c3c;
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.1);
}

body.theme-lava h1 {
    color: #fab1a0;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.4);
}

/* 9. Zen: Minimal Peace */
body.theme-zen {
    --primary-color: #576574;
    --secondary-color: #8395a7;
    background: #f5f6fa;
    color: #2f3542;
    font-family: 'Outfit', sans-serif;
}

body.theme-zen .card {
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

body.theme-zen .navbar {
    box-shadow: none;
    border-bottom: 1px solid #ddd;
}

/* 10. Future: Neon Grid */
body.theme-future {
    --primary-color: #00ff88;
    --secondary-color: #00bdff;
    background: #050505 !important;
    color: #f0f0f0;
}

body.theme-future .card {
    background: #111;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.05);
}

body.theme-future .btn-submit {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

body.theme-future .btn-submit:hover {
    background: var(--primary-color);
    color: black;
    box-shadow: 0 0 15px var(--primary-color);
}

/* Animation Base for Frames */
@keyframes spin-aura {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


.btn-logout:hover {
    transform: translateY(-2px);
}

/* Role Switcher */
.role-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem;
    border-radius: 12px;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.role-btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    margin-left: 0 !important;
    border-radius: 8px !important;
    color: #555 !important;
    transition: all 0.3s;
}

.role-btn.active {
    background: white;
    color: var(--primary-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.role-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

/* Forms (Login/Register) */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: stretch;
    /* ให้ทั้งสองฝั่งสูงเท่ากัน */
    gap: 3rem;
    max-width: 1000px;
    margin: 6rem auto;
    padding: 0 2rem;
}

.auth-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 420px;
    /* Match auth-box max-width */
    min-height: 420px;
    /* Reduced height to fit image without border */
    background: transparent;
    backdrop-filter: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

.login-gif {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    filter: none;
    animation: none;
}

@keyframes floatUpDown {

    0%,
    100% {
        transform: translateY(0) scale(1.0);
    }

    50% {
        transform: translateY(-15px) scale(1.02);
    }
}

@media (max-width: 850px) {
    .auth-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        margin: 2rem auto;
    }

    .auth-image {
        max-width: 320px;
        padding: 1.5rem;
    }
}

.auth-box {
    flex: 1;
    max-width: 420px;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 3rem 2.5rem;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-box h2 {
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dfe6e9;
    border-radius: 10px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
    /* Fix padding issue */
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.btn-submit {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.2);
}

.btn-submit:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(108, 92, 231, 0.3);
}

/* Dashboard Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.subject-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.5rem 1.5rem;
    border-radius: 30px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    overflow: hidden;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(26, 115, 232, 0.1);
}

.subject-icon-wrapper {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.2);
}

.subject-card:hover .subject-icon-wrapper {
    transform: scale(1.05);
}

.subject-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3436;
    margin-top: 0.5rem;
}

.subject-meta {
    font-size: 0.9rem;
    color: #636e72;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 15px;
    border-radius: 12px;
    width: 80%;
}

/* General Cards */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.assignment-card {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Text Wrapping Fixes */
p,
h1,
h2,
h3,
.card,
.assignment-card {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Subject Detail */
.subject-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.subject-header h1 {
    font-size: 3rem;
    background: -webkit-linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.upload-section {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* Gallery (Scattered) */
.gallery-container {
    position: relative;
    height: 80vh;
    width: 100%;
    /* overflow: hidden; Removed to allow scrolling if needed, but intended for fixed "desk" feel first */
}

.submission-card {
    position: absolute;
    /* Key for scattered effect */
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 200px;
    transition: transform 0.3s, z-index 0.3s;
    cursor: pointer;
    border: 1px solid #eee;
}

.submission-card:hover {
    z-index: 100;
    transform: scale(1.1) rotate(0deg) !important;
    /* Reset rotation on hover */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.file-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.8rem;
    color: #888;
}

/* Animation Container */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-emoji {
    position: absolute;
    font-size: 2rem;
    opacity: 0.5;
    animation: floatUp 15s linear infinite;
}

.rainbow-text {
    background: linear-gradient(to right, #0052d4, #4364f7, #6fb1fc, #0052d4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation-name: floatUp, rainbow;
    animation-timing-function: linear, ease-in-out;
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(110vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Profile Frames - Original Stable Version */
.avatar-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 14px);
    height: calc(100% + 14px);
    border-radius: 50%;
    z-index: 5;
    pointer-events: none;
    border-style: solid;
    border-width: 0;
    box-sizing: border-box;
    transition: all 0.3s;
}

/* None: Clear with simple shadow */
.avatar-frame.none {
    border-width: 2px;
    border-color: rgba(0, 0, 0, 0.1);
}

/* Bronze Level */
.avatar-frame.bronze {
    border-width: 5px;
    border-color: #cd7f32;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.4);
}

/* Silver Level */
.avatar-frame.silver {
    border-width: 5px;
    border-color: #e0e0e0;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.4);
}

/* Gold Level */
.avatar-frame.gold {
    border-width: 6px;
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: gold-pulse-original 2s infinite ease-in-out;
}

@keyframes gold-pulse-original {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.02);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

/* Diamond Level */
.avatar-frame.diamond {
    border-width: 6px;
    border-color: #b9f2ff;
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.6);
    background: linear-gradient(135deg, rgba(185, 242, 255, 0.4), transparent, rgba(162, 155, 254, 0.4));
    animation: diamond-shine-original 3s infinite linear;
}

@keyframes diamond-shine-original {
    0% {
        filter: hue-rotate(0deg);
    }

    100% {
        filter: hue-rotate(360deg);
    }
}

@keyframes ninja-pulse {
    from {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 20px #e67e22;
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 60px #e67e22;
    }
}

@keyframes ninja-spin {
    from {
        transform: translateX(-50%) rotate(0deg);
    }

    to {
        transform: translateX(-50%) rotate(360deg);
    }
}

@keyframes tide-swell-hyper {

    0%,
    100% {
        transform: translate(-50%, -55%) scale(1.3);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -45%) scale(1.6);
        opacity: 0.8;
    }
}

@keyframes waves-move {

    0%,
    100% {
        transform: translate(-50%, -55%) scale(1.2);
    }

    50% {
        transform: translate(-50%, -45%) scale(1.4);
    }
}

@keyframes luffy-hat-hyper {

    0%,
    100% {
        transform: translateY(0) rotate(-10deg) scale(1);
    }

    50% {
        transform: translateY(-15px) rotate(10deg) scale(1.2);
    }
}

@keyframes luffy-hat-float {

    0%,
    100% {
        transform: rotate(-10deg) translateY(0);
    }

    50% {
        transform: rotate(10deg) translateY(-10px);
    }
}

/* Premium Badge */
.point-badge-premium {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    margin: 15px 0;
    box-shadow: 0 10px 25px rgba(108, 92, 231, 0.4);
    overflow: hidden;
    animation: badgePulse 2s infinite ease-in-out;
}

.point-badge-premium .glow-effect {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    animation: rotateGlow 4s linear infinite;
    pointer-events: none;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- MOBILE RESPONSIVENESS (v5.1 Final Polish) --- */
@media (max-width: 992px) {
    .container {
        padding: 0 1.25rem;
    }
}

@media (max-width: 768px) {

    /* Main Layout */
    .container {
        padding: 0 0.8rem;
        margin: 1rem auto;
    }

    /* Navbar Modern Mobile Fix */
    .navbar {
        padding: 0.8rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .logo {
        text-align: center;
        width: 100%;
    }

    .nav-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        width: 100%;
    }

    .nav-links a {
        margin: 0 !important;
        text-align: center;
        padding: 12px 5px;
        font-size: 0.85rem;
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    }

    .nav-links a[href*="profile"] {
        grid-column: span 2;
        background: var(--primary-color);
        color: white !important;
        padding: 14px;
        font-weight: 600;
    }

    .btn-logout {
        grid-column: span 2;
        width: 100%;
        padding: 12px;
        font-size: 0.95rem;
        background: #fffafa;
        color: #ff4757 !important;
        border: 1px solid rgba(255, 71, 87, 0.2);
    }

    /* Role Switcher */
    .role-switcher {
        grid-column: span 2;
        width: 100%;
        margin: 0 0 10px 0;
        padding: 10px;
        background: rgba(0, 0, 0, 0.04);
        border-radius: 15px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    /* Grids */
    .subject-grid,
    .shop-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .subject-card {
        padding: 2rem 1.25rem;
    }

    /* Section Headers */
    .subject-header {
        padding: 50px 20px !important;
        margin-bottom: 2rem;
    }

    .subject-header h1 {
        font-size: 1.8rem !important;
    }

    /* Background Animation */
    .background-animation {
        opacity: 0.15;
    }
}

@media (max-width: 480px) {
    .subject-header h1 {
        font-size: 1.4rem !important;
    }

    .nav-links a {
        font-size: 0.8rem;
    }
}

/* --- PREMIUM NOTIFICATION SYSTEM --- */
.flash-messages {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 380px;
}

.toast-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 24px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateX(120%);
    animation: toastSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: auto;
}

.toast-box.success {
    border-left: 6px solid #2ecc71;
}

.toast-box.error {
    border-left: 6px solid #e74c3c;
}

.toast-icon {
    width: 40px;
    height: 40px;
    background: #2ecc71;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 8px 15px rgba(46, 204, 113, 0.2);
}

.toast-box.error .toast-icon {
    background: #e74c3c;
    box-shadow: 0 8px 15px rgba(231, 76, 60, 0.2);
}

.toast-content {
    flex: 1;
}

.toast-title {
    display: block;
    font-weight: 800;
    color: #2d3436;
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.9rem;
    color: #636e72;
    font-weight: 500;
}

@keyframes toastSlideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

.toast-box.hiding {
    animation: toastSlideOut 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@media (max-width: 480px) {
    .flash-messages {
        top: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}