:root {
    --bg-color: #f0ede4;
    --text-color: #004741;
    --card-bg: #ffffff;
    --accent: #004741;
    --accent-light: #e6f0ef;
    --border-color: #c0d1cf;
    --shadow: 0 4px 6px -1px rgba(0, 71, 65, 0.1), 0 2px 4px -1px rgba(0, 71, 65, 0.06);
    --hover-shadow: 0 10px 15px -3px rgba(0, 71, 65, 0.1), 0 4px 6px -2px rgba(0, 71, 65, 0.05);
    --animation-speed: 0.3s;
}

html {
    font-size: 100%;
    background-color: var(--bg-color);
    zoom: 85%;
}

@media (max-width: 768px) {
    html {
        zoom: 75%;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 1.25rem 1.25rem 7.5rem 1.25rem;
    opacity: 0;
    transition: opacity var(--animation-speed) ease-in-out;
    box-sizing: border-box;
}

body.loaded {
    opacity: 1;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

input,
textarea,
select {
    font-size: 16px !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

.container {
    background-color: transparent;
    max-width: 1200px;
    width: 100%;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes cardStagger {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 0 rgba(0, 71, 65, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 71, 65, 0.5);
    }

    100% {
        box-shadow: 0 0 0 rgba(0, 71, 65, 0.3);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Header Styling */
.header {
    margin-bottom: 1.5rem;
    animation: slideDown var(--animation-speed) ease-out;
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, var(--bg-color) 0%, rgba(240, 237, 228, 0.95) 100%);
    backdrop-filter: blur(10px);
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(192, 209, 207, 0.3);
}

/* Always a single row: left side | right side */
.header-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

/* Logo and title container: compact layout */
.header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    flex: 0 1 auto;
    min-width: 0;
    /* allow text to truncate if needed */
}

/* Admin button container: compact layout */
.header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.app-logo:hover {
    opacity: 0.9;
}

.header-text {
    min-width: 0;
}

.header-text h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-subtitle {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.7;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-color);
    animation: fadeInUp var(--animation-speed) ease-out;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: scaleIn var(--animation-speed) ease-out;
}

input[type="file"] {
    margin-bottom: 1rem;
    width: 100%;
    font-size: 0.9rem;
    padding: 0.8rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--accent-light);
    cursor: pointer;
    transition: all var(--animation-speed);
}

input[type="file"]:hover {
    border-color: var(--accent);
    background: rgba(230, 240, 239, 0.8);
}

button {
    background-color: var(--accent);
    color: var(--card-bg);
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--animation-speed), background-color var(--animation-speed);
    width: 100%;
    font-size: 0.95rem;
}

button:hover {
    opacity: 0.92;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#uploadStatus {
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

/* Controls */
.controls-section {
    margin-bottom: 2rem;
}

#searchInput {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 16px !important;
    margin-bottom: 1rem;
    box-shadow: none;
    outline: none;
    transition: border-color var(--animation-speed);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--card-bg);
}

#searchInput:focus {
    border-color: var(--accent);
}

.filters {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    width: auto;
    cursor: pointer;
    transition: all var(--animation-speed);
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-chip.active {
    background-color: var(--accent);
    color: var(--card-bg);
    border-color: var(--accent);
}

/* Course Cards */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    animation: fadeInUp var(--animation-speed) ease-out;
}

.courses-grid .course-card:nth-child(1) {
    animation: cardStagger var(--animation-speed) ease-out 0s;
}

.courses-grid .course-card:nth-child(2) {
    animation: cardStagger var(--animation-speed) ease-out 0.1s;
}

.courses-grid .course-card:nth-child(3) {
    animation: cardStagger var(--animation-speed) ease-out 0.2s;
}

.courses-grid .course-card:nth-child(4) {
    animation: cardStagger var(--animation-speed) ease-out 0.3s;
}

.courses-grid .course-card:nth-child(n+5) {
    animation: cardStagger var(--animation-speed) ease-out 0.4s;
}

.loading-text {
    text-align: center;
    font-weight: 500;
    animation: pulse 2s infinite;
}

.course-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: border-color var(--animation-speed), box-shadow var(--animation-speed);
    cursor: pointer;
    position: relative;
}

.course-card:hover {
    border-color: var(--accent);
    box-shadow: var(--hover-shadow);
}

.course-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.course-icon {
    font-size: 1.75rem;
    background-color: var(--accent-light);
    padding: 0.65rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-info h2 {
    margin: 0 0 0.2rem 0;
    font-size: 1.15rem;
    color: var(--text-color);
}

.course-info .course-code {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.resources-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.9rem;
    background-color: #fbfbf9;
    border-radius: 6px;
    border: 1px solid #e2eae8;
    gap: 0.75rem;
    transition: border-color var(--animation-speed), background-color var(--animation-speed);
    position: relative;
}

.resource-item:hover {
    background-color: var(--accent-light);
    border-color: var(--accent);
}

.resource-main {
    flex: 1;
    min-width: 0;
}

.resource-name {
    font-weight: 500;
    font-size: 0.92rem;
    word-break: break-word;
    color: var(--text-color);
}

.resource-type-badge {
    font-size: 0.68rem;
    background-color: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    margin-top: 0.25rem;
    display: inline-block;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.resource-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    flex-shrink: 0;
}

.action-btn {
    width: auto;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: opacity var(--animation-speed), background-color var(--animation-speed);
}

.action-btn.view {
    background-color: var(--accent);
    color: var(--card-bg);
    border: 1px solid var(--accent);
}

.action-btn.view:hover {
    opacity: 0.9;
}

/* Three Dots and Roger Menu */
.roger-menu-wrap {
    position: relative;
    display: inline-flex;
}

.roger-btn {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--animation-speed);
}

.roger-btn:hover {
    background: var(--card-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.roger-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--hover-shadow);
    min-width: 170px;
    z-index: 120;
    padding: 0.3rem;
    flex-direction: column;
}

.roger-dropdown.active {
    display: flex;
}

.roger-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    color: var(--text-color);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-decoration: none;
    font-weight: 500;
    transition: background-color var(--animation-speed);
}

.roger-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.roger-item.danger {
    color: #dc2626;
}

.roger-item.danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.action-btn.view:hover {
    background-color: transparent;
    color: var(--accent);
}

.action-btn.download {
    background-color: var(--accent);
    color: white;
}

.no-results {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
    animation: fadeInUp var(--animation-speed) ease-out;
}

/* Favorites */
.action-btn.fav {
    background-color: transparent;
    color: #d1d5db;
    border: 1px solid var(--border-color);
    transition: all var(--animation-speed);
}

.action-btn.fav.active {
    background-color: #fef3c7;
    color: #d97706;
    border-color: #fde68a;
    animation: scaleIn var(--animation-speed) ease-out;
}

.action-btn.fav:hover {
    background-color: #fef3c7;
}

/* AI Button */
.action-btn.ai-btn {
    background: linear-gradient(135deg, #004741, #007c72);
    color: white;
    border: none;
    animation: slideDown var(--animation-speed) ease-out;
}

.action-btn.ai-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 71, 65, 0.3);
    transform: translateY(-2px);
}

.resource-actions {
    flex-wrap: wrap;
}

/* AI Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: fadeIn var(--animation-speed) ease-out;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 800px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: scaleIn var(--animation-speed) ease-out;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #9ca3af;
    width: auto;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: all var(--animation-speed);
}

.close-btn:hover {
    color: var(--text-color);
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-quick-actions {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.ai-quick-actions::-webkit-scrollbar {
    display: none;
}

.ai-action-btn {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    width: auto;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--animation-speed);
}

.ai-action-btn:hover {
    border-color: var(--accent);
    background: #ddeae8;
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: pre-wrap;
    animation: slideDown var(--animation-speed) ease-out;
}

.chat-message.ai {
    background: var(--bg-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text-color);
}

.chat-message.user {
    background: var(--accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.modal-footer input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    font-size: 16px !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: all var(--animation-speed);
}

.modal-footer input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 71, 65, 0.1);
}

.modal-footer button {
    width: auto;
    padding: 0.8rem 1.5rem;
}

/* Admin Button */
.admin-btn {
    background: transparent;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--animation-speed);
    animation: slideDown var(--animation-speed) ease-out;
    position: relative;
    overflow: hidden;
}

.admin-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 71, 65, 0.1);
    transform: translate(-50%, -50%);
    transition: width var(--animation-speed), height var(--animation-speed);
}

.admin-btn:hover::after {
    width: 200px;
    height: 200px;
}

.admin-btn:hover {
    background: rgba(0, 71, 65, 0.1);
    transform: translateY(-2px);
}

.admin-welcome {
    display: none;
    color: var(--text-color);
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
    animation: slideDown var(--animation-speed) ease-out;
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(230, 240, 239, 0.5) 100%);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

/* Admin Login Modal */
.admin-login-modal {
    max-width: 420px !important;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 71, 65, 0.1);
    transform: scale(1.01);
}

.form-group input {
    transition: all var(--animation-speed);
}

#loginError {
    display: none;
    animation: shake 0.4s ease-in-out;
}

#loginAttempts {
    animation: slideDown var(--animation-speed) ease-out;
}

.delete-btn:hover {
    opacity: 0.8;
}

/* Favicon Navigation Bar */
.favicon-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.4rem 0;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    animation: slideUp var(--animation-speed) ease-out;
    /* Scale the bar with browser zoom via font-size inheritance */
    font-size: 1rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.favicon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-color);
    opacity: 0.6;
    transition: all var(--animation-speed);
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    flex: 1;
    position: relative;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.favicon-icon {
    font-size: 1.4rem;
    line-height: 1;
    transition: transform var(--animation-speed);
    display: block;
    /* Ensure Bootstrap Icon font renders correctly */
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
}

.favicon-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: radial-gradient(circle at center, rgba(0, 71, 65, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--animation-speed);
}

.favicon-item:hover::before {
    opacity: 1;
}

.favicon-item:hover {
    opacity: 1;
    background: var(--accent-light);
    color: var(--accent);
}

.favicon-item:hover .favicon-icon {
    transform: scale(1.2) translateY(-2px);
}

/* Active tab state */
.favicon-item.active {
    opacity: 1;
    color: var(--accent);
    background: var(--accent-light);
}

.favicon-item.active .favicon-icon {
    transform: scale(1.15);
}

.favicon-item.active::after {
    content: '';
    position: absolute;
    bottom: -0.1rem;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.favicon-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    transition: all var(--animation-speed);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* === Nav upload action button === */
.nav-upload {
    opacity: 1 !important;
    /* always visible */
}

.upload-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--accent);
    border-radius: 8px;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 71, 65, 0.25);
    transition: all var(--animation-speed);
    margin-bottom: 0.15rem;
}

.nav-upload:hover .upload-pill,
.nav-upload.active .upload-pill {
    background: #005f57;
    opacity: 0.95;
}

/* Don't apply the active bar-line underline to upload */
.nav-upload.active::after {
    display: none;
}

.nav-upload .favicon-label {
    color: var(--accent);
    opacity: 1;
}

/* === Notice icon wrapper + badge === */
.notice-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notice-badge {
    position: absolute;
    top: -0.2rem;
    right: -0.3rem;
    width: 0.65rem;
    height: 0.65rem;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    animation: pulse 2s infinite;
}

/* === Notices Modal === */
.notices-modal {
    max-width: 460px !important;
    height: auto !important;
    max-height: 80vh !important;
}

.notice-card {
    background: var(--bg-color);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--accent);
    margin-bottom: 0.8rem;
    animation: slideDown var(--animation-speed) ease-out;
}

.notice-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #999;
}

.notice-card-delete {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    width: auto;
    padding: 0;
    font-weight: 600;
}

.notice-card-delete:hover {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.notice-empty {
    text-align: center;
    color: #aaa;
    font-size: 0.95rem;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.notice-empty i {
    font-size: 2.5rem;
    color: var(--border-color);
}

.notices-post-footer {
    flex-direction: column !important;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Admin Login Modal: Compact, perfectly proportioned */
.admin-login-modal {
    max-width: 420px !important;
    height: auto !important;
    max-height: 90vh !important;
    border-radius: 8px !important;
}

.admin-login-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.35rem;
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrap input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.85rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    outline: none !important;
    background-color: #fafafa !important;
    transition: border-color var(--animation-speed) !important;
}

.password-input-wrap input:focus {
    border-color: var(--accent) !important;
    background-color: #ffffff !important;
}

.toggle-password-btn {
    position: absolute;
    right: 0.4rem;
    background: transparent !important;
    border: none !important;
    color: #777 !important;
    cursor: pointer;
    padding: 0.35rem !important;
    width: auto !important;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.toggle-password-btn:hover {
    color: var(--accent) !important;
    opacity: 1 !important;
}

.admin-hint {
    font-size: 0.78rem;
    color: #666;
    margin-top: 0.45rem;
    line-height: 1.4;
    margin-bottom: 0;
}


/* Responsive Media Queries */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
    }

    /* header stays row on tablet too */
    .header-content {
        flex-direction: row;
    }

    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.6rem 0.6rem 7rem 0.6rem;
    }

    .container {
        padding: 0;
    }

    .header {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }

    /* ALWAYS row on mobile */
    .header-content {
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-left {
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-text h1 {
        font-size: 1rem;
    }

    .header-subtitle {
        font-size: 0.65rem;
    }

    .app-logo {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .course-card {
        padding: 1.2rem;
    }

    .resource-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .resource-actions {
        width: auto;
        justify-content: flex-end;
    }

    .action-btn {
        flex: initial;
    }

    .modal-content {
        height: 85vh;
        max-height: 90vh;
    }

    #searchInput {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem 0.5rem 6.5rem 0.5rem;
    }

    .header {
        padding: 0.4rem 0;
        margin-bottom: 0.8rem;
    }

    /* Keep single row: no wrapping */
    .header-content {
        flex-direction: row;
        gap: 0.4rem;
    }

    .header-left {
        flex-direction: row;
        gap: 0.4rem;
    }

    .header-text h1 {
        font-size: 0.9rem;
    }

    .header-subtitle {
        font-size: 0.6rem;
    }

    .app-logo {
        width: 32px;
        height: 32px;
        border-radius: 7px;
    }

    .admin-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }

    .admin-welcome {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .course-card {
        padding: 1rem;
    }

    .course-header {
        gap: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .course-icon {
        font-size: 1.3rem;
        padding: 0.5rem;
    }

    .course-info h2 {
        font-size: 1rem;
    }

    .course-info .course-code {
        font-size: 0.75rem;
    }

    #searchInput {
        padding: 0.8rem 1rem;
        font-size: 16px;
    }

    .section-title {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }

    .upload-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .modal-content {
        max-width: 95vw;
        height: 90vh;
    }

    .modal-header {
        padding: 0.8rem 1rem;
    }

    .modal-body {
        padding: 1rem;
        gap: 1rem;
    }

    .modal-footer {
        padding: 0.8rem 1rem;
    }

    .favicon-bar {
        padding: 0.3rem 0;
    }

    .favicon-item {
        max-width: 50px;
        padding: 0.3rem 0.3rem;
    }

    .favicon-label {
        font-size: 0.55rem;
    }

    .favicon-icon {
        font-size: 1.15rem;
    }

    .filter-chip {
        padding: 0.35rem 0.7rem;
        font-size: 0.78rem;
    }

    .resource-item {
        padding: 0.6rem;
    }

    .resource-name {
        font-size: 0.9rem;
    }

    .action-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* Navigation Breadcrumbs Bar */
.nav-breadcrumbs-bar {
    display: none;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.back-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 0.95rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    transition: background-color var(--animation-speed);
}

.back-btn:hover {
    background-color: #005f57;
}

.current-path-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.path-icon {
    font-size: 1.25rem;
    color: var(--accent);
    flex-shrink: 0;
}

#currentPath {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Folder View and Responsive Resource Grid */
.folder-card {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    box-sizing: border-box;
}

.folder-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.85rem;
    width: 100%;
}

.folder-card .resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background-color: #fbfbf9;
    border-radius: 6px;
    border: 1px solid #e2eae8;
    gap: 0.85rem;
    transition: border-color var(--animation-speed), background-color var(--animation-speed);
}

.folder-card .resource-item:hover {
    background-color: var(--accent-light);
    border-color: var(--accent);
}

.folder-card .resource-name {
    font-size: 0.92rem;
    line-height: 1.4;
    word-break: break-word;
    font-weight: 500;
}

/* App Footer */
.app-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.82rem;
    color: #666;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.footer-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-dot {
    color: var(--border-color);
}

.footer-copy {
    margin: 0;
    color: #777;
    font-size: 0.78rem;
}

.footer-author {
    margin: 0.35rem 0 0.25rem 0;
    font-size: 0.82rem;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.author-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: opacity var(--animation-speed);
}

.author-link:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* === Landing Page & View Switching Styles === */
.view-section {
    animation: fadeIn var(--animation-speed) ease-out;
}

.landing-hero {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.25rem 1.75rem;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.hero-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0.25rem 0 0.65rem 0;
    line-height: 1.25;
}

.hero-desc {
    max-width: 650px;
    margin: 0 auto 1.5rem auto;
    color: #555;
    line-height: 1.6;
    font-size: 0.98rem;
}

.hero-actions {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-primary-btn {
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    border-radius: 6px;
    width: auto;
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    cursor: pointer;
}

.hero-secondary-btn {
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    border-radius: 6px;
    width: auto;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    cursor: pointer;
}

.hero-secondary-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    color: #666;
    font-weight: 500;
    margin-top: 0.35rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.35rem;
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem 0;
    color: var(--text-color);
    font-weight: 600;
}

.feature-card p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.landing-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1rem 0;
}

.landing-section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
    font-weight: 700;
}

.view-all-link {
    background: transparent;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
    padding: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Search Page Styles */
.search-view-header {
    margin-bottom: 1.25rem;
}

.search-view-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
    font-weight: 700;
}

.search-view-header p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.1rem;
    color: #777;
    pointer-events: none;
}

.search-input-wrap #searchInput {
    padding-left: 2.75rem !important;
}

.search-results-info {
    font-size: 0.88rem;
    color: #666;
    margin: 0.5rem 0 1rem 0;
    font-weight: 500;
}

@media (max-width: 600px) {
    .landing-hero {
        padding: 1.75rem 1.25rem;
    }

    .hero-title {
        font-size: 1.45rem;
    }

    .hero-desc {
        font-size: 0.88rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

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

.landing-search-bar-wrap {
    width: 100%;
    max-width: 620px;
    margin: 1.5rem auto 1.25rem auto;
}

.landing-search-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.35rem 0.45rem 0.35rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 71, 65, 0.08);
    transition: all var(--animation-speed);
}

.landing-search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 71, 65, 0.16);
}

.landing-search-icon {
    font-size: 1.15rem;
    color: #666;
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.landing-search-bar input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.6rem 0.25rem !important;
    font-size: 16px !important;
    color: var(--text-color);
    min-width: 0;
}

.landing-search-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: auto !important;
    flex-shrink: 0;
    transition: opacity var(--animation-speed);
}

.landing-search-btn:hover {
    opacity: 0.92;
}

@media (max-width: 600px) {
    .landing-search-bar-wrap {
        margin: 1.25rem 0 1rem 0;
    }

    .landing-search-btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.85rem;
    }
}