body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #faf8f3;
    color: #333;
}

/* Header */
/* Navbar */
.custom-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f3efe4; /* Beige */
    padding: 10px 20px;
    font-size: 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    gap: 15px;
}

/* Left Side */
.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.menu-icon {
    font-size: 22px;
    color: #555;
    cursor: pointer;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: #777;
}

.logo-highlight {
    font-family: 'Brush Script MT', cursive;
    font-size: 22px;
    color: #555;
}

/* Search Bar */
.search-container {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 5px 15px;
    gap: 10px;
    flex: 1;
    max-width: 500px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-container input {
    border: none;
    outline: none;
    font-size: 16px;
    flex: 1;
}

.search-container i {
    color: #888;
    font-size: 16px;
    cursor: pointer;
}

/* Right Side Icons */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-right i {
    font-size: 18px;
    color: #777;
    cursor: pointer;
}

/* Responsive Header */
@media (max-width: 1200px) {
    .nav-left {
        margin-left: 200px !important;
    }
    .nav-right {
        margin-right: 150px !important;
    }
    .search-container {
        max-width: 450px;
    }
}

@media (max-width: 992px) {
    .nav-left {
        margin-left: 150px !important;
    }
    .nav-right {
        margin-right: 100px !important;
    }
    .search-container {
        max-width: 400px;
    }
    .logo-text {
        font-size: 18px;
    }
    .logo-highlight {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .nav-left {
        margin-left: 100px !important;
    }
    .nav-right {
        margin-right: 50px !important;
    }
    .search-container {
        max-width: 300px;
    }
    .logo-text {
        font-size: 16px;
    }
    .logo-highlight {
        font-size: 18px;
    }
    .custom-navbar {
        padding: 8px 15px;
    }
}

@media (max-width: 576px) {
    .custom-navbar {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        padding: 15px 20px;
    }
    .nav-left {
        margin-left: 0 !important;
        order: 1;
        width: 100%;
        justify-content: center;
    }
    .search-container {
        order: 2;
        max-width: 100%;
        width: 100%;
        margin: 0 10px;
    }
    .nav-right {
        margin-right: 0 !important;
        order: 3;
        width: 100%;
        justify-content: center;
    }
    .logo-text {
        font-size: 18px;
    }
    .logo-highlight {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .custom-navbar {
        padding: 12px 15px;
        gap: 10px;
    }
    .nav-left, .nav-right {
        gap: 8px;
    }
    .search-container {
        padding: 4px 12px;
        margin: 0 5px;
    }
    .search-container input {
        font-size: 14px;
    }
    .menu-icon {
        font-size: 20px;
    }
    .nav-right i {
        font-size: 16px;
    }
    .logo-text {
        font-size: 16px;
    }
    .logo-highlight {
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .custom-navbar {
        padding: 10px 10px;
        gap: 8px;
    }
    .search-container {
        padding: 3px 10px;
        margin: 0 2px;
    }
    .search-container input {
        font-size: 13px;
    }
    .logo-text {
        font-size: 14px;
    }
    .logo-highlight {
        font-size: 16px;
    }
    .menu-icon {
        font-size: 18px;
    }
    .nav-right i {
        font-size: 14px;
    }
}

/* Homepage */
.homepage {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}
.welcome-section h1 {
    color: #0073c6;
}
.welcome-section a {
    color: #0073c6;
    text-decoration: none;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive card grid */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 100%;
    }
}

.card {
    background: #fffaf0;
    padding: 30px 20px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* Ensure all cards are the same size */
    min-height: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: all 0.3s ease;
    border: 1px solid #e8e4d9;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #fff8e6;
}

/* Footer */
.footer {
    text-align: center;
    padding: 8px;
    background: #eae6dc;
    font-size: 14px;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: #f8f7f4;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header .logo-text {
    font-size: 18px;
    font-weight: bold;
    color: #555;
}

.sidebar-header .logo-highlight {
    font-family: 'Brush Script MT', cursive;
    font-size: 20px;
    color: #555;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-menu li:last-child {
    border-bottom: none;
}

.sidebar-link {
    display: block;
    padding: 15px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s ease;
}

.sidebar-link:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }
}

/* Expand button styles */
#expand-btn {
    cursor: pointer;
    transition: transform 0.3s ease;
}

#expand-btn:hover {
    transform: scale(1.1);
}

/* EXPANDED MODE - BETTER SOLUTION */
body.expanded {
    overflow: hidden;
    height: 100vh;
}

/* Fixed header in expanded mode */
body.expanded .custom-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: #f3efe4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: 60px;
}

/* Main content area in expanded mode */
body.expanded main {
    position: fixed;
    top: 60px; /* Height of header */
    left: 0;
    right: 0;
    bottom: 40px; /* Height of footer */
    overflow-y: auto;
    background: #faf8f3;
    padding: 20px;
}

/* All page containers in expanded mode */
body.expanded .homepage,
body.expanded .container,
body.expanded .content-wrapper,
body.expanded .page-content {
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Welcome section in expanded mode */
body.expanded .welcome-section {
    margin-bottom: 30px;
}

/* Card grid in expanded mode - ensures all cards are visible */
body.expanded .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px; /* Space before footer */
    flex: 1;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive card grid in expanded mode */
@media (max-width: 768px) {
    body.expanded .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    body.expanded .card-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
}

/* Individual cards in expanded mode */
body.expanded .card {
    padding: 40px 25px;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background: #fffaf0;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Maintain consistent sizing in expanded mode */
    min-height: 120px;
    height: 120px;
    border: 1px solid #e8e4d9;
}

body.expanded .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    background: #fff8e6;
}

/* Fixed footer ONLY in expanded mode */
body.expanded .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: #eae6dc;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Expand button rotation */
#expand-btn.expanded {
    transform: rotate(180deg);
}

/* Ensure sidebar stays on top in expanded mode */
body.expanded .sidebar {
    z-index: 1002;
}

body.expanded .sidebar-overlay {
    z-index: 1001;
}

/* Dark mode toggle styles */
#dark-mode-toggle {
    cursor: pointer;
    transition: transform 0.3s ease;
}

#dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* DARK MODE STYLES */
body.dark-mode {
    background: #1a1a1a;
    color: #ffffff;
}

body.dark-mode .custom-navbar {
    background: #2d2d2d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

body.dark-mode .nav-right i {
    color: #ffffff;
}

body.dark-mode .logo-text {
    color: #ffffff;
}

body.dark-mode .logo-highlight {
    color: #ffffff;
}

body.dark-mode .menu-icon {
    color: #ffffff;
}

body.dark-mode .search-container {
    background: #3a3a3a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body.dark-mode .search-container input {
    background: #3a3a3a;
    color: #ffffff;
}

body.dark-mode .search-container input::placeholder {
    color: #cccccc;
}

body.dark-mode .search-container i {
    color: #cccccc;
}

body.dark-mode .card {
    background: #2d2d2d;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

body.dark-mode .footer {
    background: #2d2d2d;
    color: #ffffff;
}

body.dark-mode .sidebar {
    background: #2d2d2d;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}

body.dark-mode .sidebar-header {
    border-bottom: 1px solid #404040;
}

body.dark-mode .sidebar-header .logo-text {
    color: #ffffff;
}

body.dark-mode .sidebar-header .logo-highlight {
    color: #ffffff;
}

body.dark-mode .sidebar-menu li {
    border-bottom: 1px solid #404040;
}

body.dark-mode .sidebar-link {
    color: #ffffff;
}

body.dark-mode .sidebar-link:hover {
    background-color: #404040;
    color: #ffffff;
}

/* Dark mode in expanded state */
body.dark-mode.expanded main {
    background: #1a1a1a;
}

body.dark-mode.expanded .card {
    background: #2d2d2d;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

body.dark-mode.expanded .card:hover {
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

body.dark-mode.expanded .footer {
    background: #2d2d2d;
    color: #ffffff;
}

body.dark-mode.expanded .custom-navbar {
    background: #2d2d2d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Dark mode toggle animation */
#dark-mode-toggle.dark {
    transform: rotate(180deg);
}

/* Category Links */
.category-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    transition: none;
    /* Remove all click effects */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
}

.category-link:hover {
    text-decoration: none;
    color: inherit;
    transform: none;
    box-shadow: none;
    background: none;
}

.category-link:active {
    text-decoration: none;
    color: inherit;
    transform: none;
    box-shadow: none;
    background: none;
    outline: none;
}

.category-link:focus {
    text-decoration: none;
    color: inherit;
    transform: none;
    box-shadow: none;
    background: none;
    outline: none;
}

/* Dark mode category links */
body.dark-mode .category-link {
    color: #ffffff;
}

body.dark-mode .category-link:hover {
    color: #ffffff;
}

body.dark-mode .category-link:active {
    color: #ffffff;
}

body.dark-mode .category-link:focus {
    color: #ffffff;
}
