/* 
 * ห้องสื่อครูคอม - Teacher Media Room
 * Clean White Theme with Colorful Borders
 * Font: Sarabun
 */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Primary - Vibrant Blue */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;

    /* Rainbow Accent Colors */
    --red: #ef4444;
    --orange: #f97316;
    --yellow: #eab308;
    --green: #22c55e;
    --teal: #14b8a6;
    --blue: #3b82f6;
    --purple: #a855f7;
    --pink: #ec4899;

    /* Status */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Clean Backgrounds */
    --bg-main: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --transition: all 0.2s ease;
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sarabun', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-main);
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-main);
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple), var(--pink)) 1;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
    box-shadow: var(--shadow-sm);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    flex-wrap: wrap;
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: var(--bg-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo span {
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    gap: 12px;
    transition: var(--transition);
    min-width: 300px;
}

.search-bar:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar i {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--bg-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

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

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-facebook {
    background: #1877f2;
    color: white;
}

.btn-facebook:hover {
    background: #166fe5;
}

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

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

.btn-info {
    background: #0ea5e9;
    /* Sky blue */
    color: white;
}

.btn-warning {
    background: #f59e0b;
    /* Amber */
    color: white;
}

.btn-dark {
    background: #1e293b;
    /* Slate 800 */
    color: white;
}

.btn-teal {
    background: #0d9488;
    /* Teal 600 */
    color: white;
}

.btn-orange {
    background: #f97316;
    /* Orange 500 */
    color: white;
}

.btn-pink {
    background: #db2777;
    /* Pink 600 */
    color: white;
}

.btn-danger:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-dark:hover {
    filter: brightness(0.9);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

/* Hero */
.hero {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    padding: 40px 20px;
    text-align: center;
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-emoji {
    font-size: 3rem;
    margin-bottom: 16px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    padding-top: 8px;
    line-height: 1.4;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 24px;
}

/* Category Section */
.category-section {
    background: white;
    border: 2px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.category-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.category-section-title i {
    color: var(--primary);
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--border-light);
}

.category-filter::-webkit-scrollbar {
    width: 8px;
}

.category-filter::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 10px;
}

.category-filter::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.category-filter::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.category-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: white;
}

.category-pill.active {
    background: var(--bg-gradient);
    border-color: transparent;
    color: white;
}

.category-pill .count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.category-pill:not(.active) .count {
    background: var(--border-color);
    color: var(--text-muted);
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.file-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.file-preview {
    position: relative;
    width: 100%;
    height: 170px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.file-card:hover .file-preview img {
    transform: scale(1.05);
}

.file-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(79, 70, 229, 0.85);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card:hover .file-preview-overlay {
    opacity: 1;
}

.file-info {
    padding: 16px;
}

.file-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.file-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-meta-item i {
    color: var(--primary-light);
}

.file-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
}

.file-external-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--pink);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    margin-left: 6px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

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

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.modal-body {
    padding: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: block;
    border-left: 4px solid;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.alert-info {
    background: #eff6ff;
    border-color: var(--blue);
    color: #1e40af;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #166534;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-danger {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: #e0e7ff;
    color: var(--primary);
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Pending */
.pending-container {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pending-card {
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.pending-icon {
    width: 80px;
    height: 80px;
    background: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
}

th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--border-color);
}

tr:hover td {
    background: var(--bg-secondary);
}

td {
    border-bottom: 1px solid var(--border-light);
}

/* Preview Tooltip */
.preview-tooltip {
    position: fixed;
    z-index: 1001;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    max-width: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    border: 2px solid var(--primary);
}

.preview-tooltip.visible {
    opacity: 1;
}

.preview-tooltip img {
    width: 100%;
    border-radius: var(--radius-sm);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer - Sticky at bottom */
.footer {
    background: var(--bg-secondary);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple)) 1;
    padding: 12px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

/* Add padding to body to account for fixed footer */
body {
    padding-bottom: 50px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Fade */
.fade-in {
    animation: fadeInUp 0.35s ease forwards;
    opacity: 0;
}

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

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

/* ============ ADMIN STYLES ============ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 100%);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.sidebar-logo span,
.sidebar-logo-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
}

.sidebar-menu-item {
    margin-bottom: 4px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-menu-link:hover,
.sidebar-menu-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.sidebar-menu-link i {
    width: 20px;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--pink);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    padding: 24px;
    background: var(--bg-main);
    min-height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.stat-icon.pending {
    background: linear-gradient(135deg, var(--warning), var(--orange));
}

.stat-icon.users {
    background: linear-gradient(135deg, var(--blue), var(--teal));
}

.stat-icon.files {
    background: linear-gradient(135deg, var(--purple), var(--pink));
}

.stat-icon.downloads {
    background: linear-gradient(135deg, var(--green), var(--teal));
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 18px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-family: 'Sarabun', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tab.active {
    background: var(--bg-gradient);
    border-color: transparent;
    color: white;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: white;
}

.upload-zone i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-zone p {
    margin: 0;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding-top: 24px;
    }

    .admin-header {
        padding-left: 50px;
    }

    #menuToggle {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        width: 100%;
        min-width: auto;
        margin-top: 8px;
    }

    .hero {
        padding: 40px 20px;
    }

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

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .modal {
        max-width: 95%;
    }

    .admin-main {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        gap: 6px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .category-pill {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .file-preview {
        height: 150px;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.d-none {
    display: none;
}

.d-flex {
    display: flex;
}

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

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.w-100 {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
    cursor: pointer;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.font-medium {
    font-weight: 500;
}

.text-white {
    color: white !important;
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: #f59e0b;
}

.text-info {
    color: #0ea5e9;
}

.text-teal {
    color: #0d9488;
}

.text-orange {
    color: #f97316;
}

.text-pink {
    color: #db2777;
}

.text-dark {
    color: #1e293b;
}

.p-2 {
    padding: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.d-sm-inline {
    display: none;
}

@media (min-width: 576px) {
    .d-sm-inline {
        display: inline;
    }
}

/* Pagination */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin-top: 14px;
    border-top: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-page {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.pagination-page:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-page.active {
    background: var(--bg-gradient);
    border-color: transparent;
    color: white;
}

.pagination-page.dots {
    background: transparent;
    border: none;
    cursor: default;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: center;
    }

    .pagination-pages {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Modal Container - Make sure it's solid and has fixed height */
.modal-container {
    background: var(--bg-main) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    /* Fixed max height for the modal */
    margin: 20px;
    position: relative;
    width: 100%;
}

[data-theme="dark"] .modal-container {
    background: #242526 !important;
    border: 1px solid #3e4042;
}

/* Modal Body needs to handle internal structure */
.modal-container .modal-body {
    padding: 0;
    /* Remove default padding, handle internally */
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    /* Prevent body scroll, let list scroll */
}

/* Comment System Styles */
.comment-btn {
    background-color: #f0f2f5;
    color: #65676b;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-btn:hover {
    background-color: #e4e6eb;
    transform: translateY(-1px);
}

.comments-list {
    flex: 1;
    /* Take remaining space */
    overflow-y: auto;
    /* Scrollable */
    padding: 15px;
    /* Add padding here */
}

.comment-item {
    display: flex;
    align-items: flex-start;
    /* Fix avatar alignment */
    gap: 10px;
    margin-bottom: 15px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Container for content to ensure full width */
.comment-content {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
}

.replies-list {
    margin-left: 42px;
    margin-top: 8px;
    /* Changed from negative to positive */
    margin-bottom: 8px;
    position: relative;
    padding-left: 10px;
    /* Space for the connecting line */
}

/* Line connecting to parent */
.replies-list::before {
    content: '';
    position: absolute;
    top: -15px;
    /* Start from parent avatar/actions area */
    left: 0;
    width: 2px;
    height: calc(100% - 15px);
    /* Stop before the last item ends */
    background: var(--border-color);
    border-radius: 0 0 0 10px;
    /* Curve the line at bottom if needed */
}

/* Curve connector for each reply item could be added here if desired, 
   but keeping it simple with a vertical line for now */

.replies-list .comment-item {
    margin-bottom: 12px;
}

.replies-list .comment-avatar {
    width: 28px;
    /* Slightly larger for better visibility */
    height: 28px;
}

.replies-list .comment-bubble {
    padding: 8px 12px;
    font-size: 0.95em;
    background-color: #f0f2f5;
    /* Distinct from parent if needed, or keep same */
}

[data-theme="dark"] .replies-list .comment-bubble {
    background-color: #3e4042;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
    margin-top: 4px;
    font-size: 0.8rem;
    /* Slightly larger text */
    font-weight: 600;
    color: #65676b;
}

.comment-action {
    cursor: pointer;
    transition: color 0.1s;
}

.comment-action:hover {
    text-decoration: underline;
    color: var(--primary);
}

.reply-input-area {
    margin-left: 52px;
    /* Align with text */
    margin-top: 8px;
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.reply-input {
    flex: 1;
    background: #f0f2f5;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.reply-input:focus {
    background: white;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

[data-theme="dark"] .reply-input {
    background: #3a3b3c;
    color: white;
}

[data-theme="dark"] .reply-input:focus {
    background: #242526;
}

/* Comment Bubble Logic */
.comment-bubble {
    background-color: #f0f2f5;
    border-radius: 18px;
    padding: 10px 14px;
    /* More padding */
    position: relative;
    max-width: fit-content;
    /* Only take necessary width */
    min-width: 120px;
}

[data-theme="dark"] .comment-bubble,
[data-theme="dark"] .comment-btn {
    background-color: #3a3b3c;
    color: #e4e6eb;
    border: 1px solid transparent;
}

[data-theme="dark"] .comment-btn:hover {
    background-color: #4e4f50;
    border-color: #5c6bc0;
}

.comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
    color: #050505;
}

[data-theme="dark"] .comment-author {
    color: #e4e6eb;
}

.comment-text {
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
    color: #050505;
}

[data-theme="dark"] .comment-text {
    color: #e4e6eb;
}

.comment-meta {
    font-size: 0.75rem;
    color: #65676b;
    margin-left: 12px;
    margin-top: 4px;
    display: flex;
    gap: 10px;
}

[data-theme="dark"] .comment-meta {
    color: #b0b3b8;
}

.comment-input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    z-index: 10;
    margin-top: 0;
    /* Sticky isn't needed with flex column, but structure implies block flow. With flex layout in modal-body, this sits at bottom naturally if comments-list expands */
    flex-shrink: 0;
    /* Keep size constant */
}

.comment-input {
    flex: 1;
    background-color: #f0f2f5;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    resize: none;
    height: 38px;
    line-height: 20px;
    outline: none;
    transition: all 0.2s;
}

.comment-input:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

[data-theme="dark"] .comment-input {
    background-color: #3a3b3c;
    color: #e4e6eb;
}

[data-theme="dark"] .comment-input:focus {
    background-color: #242526;
    border-color: var(--primary);
}

.comment-delete {
    cursor: pointer;
    color: #65676b;
    font-weight: 500;
}

.comment-delete:hover {
    text-decoration: underline;
    color: #dc3545;
}

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

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

/* User Management Responsive Toolbar */
.user-tool-bar {
    display: grid;
    grid-template-columns: 1fr minmax(320px, 450px) 1fr;
    align-items: center;
    gap: 20px;
    padding-bottom: 5px;
}

.user-tool-left {
    display: flex;
    justify-content: flex-start;
    min-height: 38px;
    align-items: center;
}

.user-tool-center {
    display: flex;
    justify-content: center;
    width: 100%;
}

.user-tool-right {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .user-tool-bar {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    /* Order: Search (1), Tabs (2), Actions (3) */
    .user-tool-center {
        order: 1;
        width: 100%;
    }

    .user-tool-right {
        order: 2;
        width: 100%;
        justify-content: center;
    }

    .user-tool-left {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .tabs {
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        white-space: nowrap;
    }

    .user-tool-left .d-flex {
        width: 100%;
    }

    .user-tool-left button {
        flex: 1;
        justify-content: center;
    }
}

/* Modern Tabs Style Override */
.tabs {
    display: flex;
    gap: 0;
    /* Remove gap, use padding/margin on items */
    background: white;
    border-bottom: 2px solid var(--border-light);
    padding: 0;
    margin-bottom: 15px;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
    /* Hide scrollbar */
}

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

.tab {
    background: transparent !important;
    /* Remove button background */
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    color: var(--text-secondary);
    padding: 12px 20px;
    font-weight: 600;
    flex: 1;
    /* Equal width on mobile */
    text-align: center;
    white-space: nowrap;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--primary);
    background: var(--bg-secondary) !important;
    opacity: 1;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary) !important;
    opacity: 1;
    background: transparent !important;
}

/* Adjust layout for new tabs */
@media (max-width: 900px) {
    .user-tool-center {
        padding: 10px 0;
        /* Add space around search */
    }

    .search-bar {
        border-radius: 8px;
        /* Less rounded on mobile fitting strictly */
    }

    .user-tool-bar {
        gap: 0;
        /* Remove grid gap, handle mostly with padding */
    }
}

/* Styled Nav Tabs */
.nav-tabs-wrapper {
    margin-bottom: 20px;
}

.nav-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    gap: 30px;
    position: relative;
    overflow-x: auto;
    /* Allow scroll on mobile */
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-link {
    background: transparent;
    border: none;
    padding: 15px 5px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Badge in tab */
.badge-warning-soft {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
}

@media (max-width: 768px) {
    .nav-tabs {
        gap: 20px;
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 12px 5px;
    }
}

/* Formal Folder Tabs */
.nav-tabs-formal {
    display: flex;
    gap: 5px;
}

.nav-tab-item {
    background: transparent;
    border: none;
    padding: 12px 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    top: 1px;
    /* To sit exactly on the line */
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tab-item:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
}

.nav-tab-item.active {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border-color);
    border-bottom: 1px solid white;
    /* Hide bottom border to merge */
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.02);
}

/* Make search formal */
.search-box-formal input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

@media (max-width: 600px) {
    .nav-tab-item {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* Enhanced Formal Tab Sizing */
.nav-tab-item {
    font-size: 1.05rem !important;
    padding: 16px 35px !important;
    font-weight: 600 !important;
}

.nav-tab-item i {
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .nav-tab-item {
        padding: 14px 20px !important;
        font-size: 1rem !important;
    }
}

/* URGENT: Much Larger Tabs */
.nav-tab-item {
    font-size: 1.25rem !important;
    padding: 20px 45px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
}

.nav-tab-item i {
    font-size: 1.4rem !important;
    margin-right: 2px;
}

.badge-warning-soft {
    font-size: 0.85rem !important;
    padding: 3px 10px !important;
}

@media (max-width: 600px) {
    .nav-tab-item {
        padding: 16px 25px !important;
        font-size: 1.1rem !important;
    }

    .nav-tab-item i {
        font-size: 1.2rem !important;
    }
}

/* Balanced Tab Sizing */
.nav-tab-item {
    font-size: 1.05rem !important;
    padding: 14px 30px !important;
    font-weight: 600 !important;
}

.nav-tab-item i {
    font-size: 1.1rem !important;
}

/* Enhanced Active Tab Visibility */
.nav-tab-item.active {
    background: white !important;
    color: var(--primary) !important;
    border: 1px solid var(--border-color) !important;
    border-bottom: 2px solid white !important;
    box-shadow: 0 -3px 8px rgba(79, 70, 229, 0.15) !important;
    font-weight: 700 !important;
}

/* More spacing for toolbar */
.user-toolbar-area {
    padding-top: 25px !important;
    padding-bottom: 10px !important;
}

@media (max-width: 600px) {
    .nav-tab-item {
        padding: 12px 20px !important;
        font-size: 1rem !important;
    }
}

/* Force Sarabun Font for Tabs */
.nav-tab-item {
    font-family: 'Sarabun', sans-serif !important;
}

/* Solid Blue Button for Word Files */
.btn-solid-blue {
    background: #2563eb !important;
    /* Royal Blue */
    color: white !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-solid-blue:hover {
    background: #1d4ed8 !important;
    transform: translateY(-1px);
}

/* Solid Purple Button for PSD/TIF Files */
.btn-solid-purple {
    background: #9333ea !important;
    /* Purple 600 */
    color: white !important;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-solid-purple:hover {
    background: #7e22ce !important;
    /* Purple 700 */
    transform: translateY(-1px);
}

/* Mobile Notification Fix */
@media (max-width: 768px) {
    #notifDropdown {
        position: fixed !important;
        top: 70px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 92% !important;
        max-width: 400px !important;
        right: auto !important;
        z-index: 9999 !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    }
}

/* Password Toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 40px;
    /* Make space for eye icon */
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--primary);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 45px;
}

.password-input-wrapper .password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 2;
}

.password-input-wrapper .password-toggle:hover {
    color: var(--primary);
}

/* Nav User Section - Desktop */
.nav-user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user-section .notification-wrapper {
    position: relative;
}

.nav-user-section .user-greeting {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.nav-user-section .nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Mobile User Bar - Professional Style */
.mobile-user-bar {
    display: none;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    font-size: 0.9rem;
    color: #495057;
}

.mobile-user-bar .container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-user-bar span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.mobile-user-bar i {
    color: var(--primary);
    font-size: 1.1rem;
}

.mobile-user-bar .container {
    flex-direction: column;
}

/* Tablet & Mobile Responsive (includes mobile landscape) */
@media (max-width: 1024px) {
    .nav-user-section .user-greeting {
        display: none;
    }

    .nav-user-section .btn-text {
        display: none;
    }

    .mobile-user-bar {
        display: block;
    }

    .nav-user-section {
        gap: 6px;
    }

    .nav-user-section .btn-sm {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .nav-user-section .btn-sm i {
        font-size: 0.9rem;
    }
}

/* Mobile Portrait - move search bar to mobile user bar */
@media (max-width: 576px) {
    .header-content {
        gap: 10px;
    }

    /* Hide search bar from header on mobile portrait */
    .header .search-bar {
        display: none !important;
    }

    .logo span {
        font-size: 1.1rem;
    }

    .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .nav-user-section .btn-sm {
        width: 34px;
        height: 34px;
    }

    .nav-user-section .btn-sm i {
        font-size: 0.85rem;
    }

    .mobile-user-bar {
        padding: 8px 0;
        font-size: 0.85rem;
    }
}

/* Hide mobile user bar on desktop (> 1024px) */
@media (min-width: 1025px) {
    .mobile-user-bar {
        display: none !important;
    }
}

/* Hide cloned search bar on landscape and larger - only show on portrait */
#mobileSearchClone {
    display: none !important;
}

@media (max-width: 576px) {
    #mobileSearchClone {
        display: flex !important;
    }
}

/* Profile Picture Styles */
.profile-picture-container {
    position: relative;
    display: inline-block;
}

.profile-picture-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-picture-edit {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.profile-picture-edit:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

.profile-picture-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.profile-picture-mini {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* Profile Nav Button */
.profile-btn-wrapper {
    position: relative;
    display: inline-block;
}

.profile-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    overflow: hidden;
}

.profile-nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(92, 107, 192, 0.3);
}

.profile-nav-btn i {
    font-size: 1.5rem;
    color: var(--primary);
}

.profile-nav-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Profile Preview Popup */
.profile-preview-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 15px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 150px;
}

.profile-btn-wrapper:hover .profile-preview-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-preview-popup img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 10px;
}

.profile-preview-popup p {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.profile-preview-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 12px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

/* Profile Hover in Admin Table */
.profile-hover-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.profile-hover-preview {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 12px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 120px;
}

.profile-hover-wrapper:hover .profile-hover-preview {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.profile-hover-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 8px;
}

.profile-hover-preview p {
    margin: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* NEW Badge Animation */
.new-badge {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 5px;
    animation: newBadgePulse 1s ease-in-out infinite;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes newBadgePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* News Card Styling */
.news-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 12px 30px rgba(231, 76, 60, 0.2) !important;
}

.news-card .file-thumbnail {
    position: relative;
    height: 180px;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.news-card .file-thumbnail::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
}

.news-card .file-info {
    padding: 16px;
}

.news-card .file-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-card .file-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* News Type Badges in Cards */
.news-card .badge {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* News Links Container */
.news-links-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.news-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: var(--bg-main);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.news-link-item:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

.news-link-item i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
}

.news-link-item .link-title {
    flex: 1;
    font-weight: 500;
}

.link-icon-youtube {
    background: #FF0000;
    color: white;
}

.link-icon-facebook {
    background: #1877F2;
    color: white;
}

.link-icon-drive {
    background: #4285F4;
    color: white;
}

.link-icon-dropbox {
    background: #0061FF;
    color: white;
}

.link-icon-website {
    background: #27ae60;
    color: white;
}

.link-icon-download {
    background: #9b59b6;
    color: white;
}

.link-icon-default {
    background: #95a5a6;
    color: white;
}

/* ============ Premium News Modal Styles ============ */
.news-modal-popup {
    border-radius: 20px !important;
    overflow: hidden;
}

.news-modal-popup .swal2-close {
    color: #333 !important;
    background: white !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 1.3rem;
    opacity: 1;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    top: 12px !important;
    right: 12px !important;
}

.news-modal-popup .swal2-close:hover {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.news-modal-container {
    text-align: left;
}

.news-modal-header {
    padding: 30px;
    color: white;
    position: relative;
    overflow: hidden;
}

.news-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {

    0%,
    100% {
        transform: translateX(-50%) rotate(0deg);
    }

    50% {
        transform: translateX(0%) rotate(180deg);
    }
}

.news-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.news-modal-badge-icon {
    font-size: 1.1rem;
}

.news-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.3;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.news-modal-date {
    font-size: 0.9rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-modal-body {
    padding: 24px;
}

.news-modal-image-wrapper {
    margin: -24px -24px 20px -24px;
    overflow: hidden;
}

.news-modal-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.news-modal-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #1a1a1a;
    font-weight: 400;
    white-space: pre-line;
}

.news-modal-links {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.news-modal-links-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.news-modal-links-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.news-link-card:hover {
    background: white;
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    transform: translateX(5px);
}

.news-link-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.news-link-info {
    flex: 1;
    min-width: 0;
}

.news-link-title {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-link-type {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.news-link-arrow {
    color: #667eea;
    font-size: 1rem;
    transition: all 0.3s;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.news-link-card:hover .news-link-arrow {
    transform: translateX(5px);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .news-modal-content {
        color: #e0e0e0;
    }

    .news-link-card {
        background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    }

    .news-link-card:hover {
        background: #333;
    }

    .news-link-title {
        color: #fff;
    }
}