/* resources.css - Scribd-Style Document Library */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --primary: #1e7b85;
    /* Scribd Teal */
    --primary-dark: #165c63;
    --text-main: #0F172A;
    --text-secondary: #666666;
    --text-muted: #999999;
    --bg-body: #f9f9f9;
    --bg-surface: #ffffff;
    --border-color: #e0e0e0;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body) !important;
    -webkit-font-smoothing: antialiased;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
.serif-font {
    font-family: var(--font-heading);
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary);
}

/* --- Layout Wrappers --- */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Sub-Navigation (Sticky) --- */
.scribd-nav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 900;
    /* Lower than modal (usually 1050) */
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* Force Modals to Top */
.modal {
    z-index: 10000 !important;
}

.modal-backdrop {
    z-index: 9999 !important;
}

.scribd-nav .nav-link {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: #333;
    margin-right: 20px;
}

/* Search Input */
.search-bar-container {
    flex-grow: 1;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid #ccc;
    background: #fdfdfd;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s;
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 123, 133, 0.1);
}

/* --- Category Pills --- */
.category-pills {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 20px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid transparent;
}

/* Beautiful scrollbar for category pills (Webkit browsers: Chrome, Safari, Edge) */
.category-pills::-webkit-scrollbar {
    height: 6px;
}

.category-pills::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-pills::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #1e7b85, #23949f);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

/* Show scrollbar on hover */
.category-pills:hover::-webkit-scrollbar-track {
    opacity: 1;
}

.category-pills:hover::-webkit-scrollbar-thumb {
    opacity: 1;
}

.category-pills::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #165c63, #1e7b85);
}

/* Firefox scrollbar styling */
.category-pills {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

.category-pills:hover {
    scrollbar-color: #1e7b85 #f1f1f1;
}

.cat-pill {
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 20px;
    background: white;
    border: 1px solid #ddd;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.cat-pill:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.cat-pill.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* --- Shelf Layout (Horizontal Scrolling) --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
    margin-top: 32px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* --- Scoped Typography --- */
.section-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 14px;
    color: #666;
    max-width: 800px;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* --- Shelf Layout --- */
.doc-shelf-wrapper {
    position: relative;
    padding: 0 40px;
    /* Space for arrows */
}

.doc-shelf {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding: 12px 4px 32px 4px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Hide scrollbar for cleaner look */
}

.doc-shelf::-webkit-scrollbar {
    display: none;
}

.shelf-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.shelf-nav:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #ccc;
}

.shelf-prev {
    left: -10px;
}

.shelf-next {
    right: -10px;
}

/* --- Document Card (Scribd Exact) --- */
.doc-card {
    flex: 0 0 auto;
    width: 190px;
    cursor: pointer;
    background: #f8f7f7;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.12);
}

.doc-card:hover {
    border: .5px solid #e83030;
}

.doc-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1.45;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-thumbnail>i {
    font-size: 4rem;
    opacity: 0.8;
}

.doc-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Color Coding --- */
.type-pdf {
    border-bottom: 3px solid #EF4444 !important;
}

.type-word {
    border-bottom: 3px solid #3B82F6 !important;
}

.type-excel {
    border-bottom: 3px solid #10B981 !important;
}

.type-ppt {
    border-bottom: 3px solid #F59E0B !important;
}

.type-image {
    border-bottom: 3px solid #8B5CF6 !important;
}

.type-archive {
    border-bottom: 3px solid #6B7280 !important;
}

/* --- Card Hover Effect --- */
/* .doc-card:hover .doc-thumbnail {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
} */


/* --- Upload Modal Styles --- */
.upload-drop-zone {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    background: #fcfcfc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
    border-color: var(--primary);
    background: #f0fdf4;
    /* Slight tint */
}

.hover-elevate {
    transition: transform 0.2s;
}

.hover-elevate:hover {
    transform: translateY(-2px);
}


/* --- Form Fixes --- */
.position-relative select {
    position: relative;
    z-index: 5;
}

.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(30, 123, 133, 0.25);
    border-color: var(--primary);
}

.doc-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    pointer-events: none;
}

.doc-card .doc-icon {
    font-size: 40px;
    color: #e0e0e0;
}

.doc-info {
    padding: 8px 0 0 0;
}

.doc-info h4 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.doc-uploader {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.uploader-link:hover {
    color: var(--primary);
    text-decoration: underline !important;
}

.clickable-uploader:hover {
    background: #f0f0f0;
    border-radius: 8px;
}

.doc-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* .doc-card:hover .doc-thumbnail img {
    transform: scale(1.05);
} */

.doc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.doc-rating {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-rating i {
    font-size: 14px;
}

.bookmark-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
    transition: color 0.2s ease;
}

.bookmark-btn:hover {
    color: var(--primary);
}

.bookmark-btn.active i {
    font-weight: 900;
    color: var(--primary);
}

/* --- Request Cards --- */
.request-card {
    background: white;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--radius-sm);
    height: 100%;
    transition: box-shadow 0.2s;
}

.request-card:hover {
    box-shadow: var(--shadow-sm);
}

/* --- Leaderboard (Sidebar) --- */
.leaderboard-card {
    background: white;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.leader-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.leader-item:last-child {
    border-bottom: none;
}

.leader-rank {
    width: 20px;
    font-weight: bold;
    color: #999;
    font-size: 14px;
}

.leader-item:nth-child(1) .leader-rank {
    color: #d4af37;
}

/* Gold */
.leader-item:nth-child(2) .leader-rank {
    color: #c0c0c0;
}

/* Silver */
.leader-item:nth-child(3) .leader-rank {
    color: #cd7f32;
}

/* Bronze */

.leader-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eee;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin: 0 12px;
}

/* --- Modals & Utilities --- */
.text-primary {
    color: var(--primary) !important;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.fab-add {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 999;
}

.fab-add:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* --- Category Icon Grid --- */
.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-dark);
    border: 1px solid #eee;
    transition: all 0.2s ease;
    height: 100%;
    min-height: 120px;
}

.cat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.cat-card.active {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
}

.cat-card.active .icon-box {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

/* --- Quick Actions Overlay --- */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.doc-card:hover .card-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.action-btn:hover,
.action-btn.active {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.action-btn.active .text-danger {
    color: #ff4d4d !important;
    /* Slightly brighter red for contrast on teal */
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .doc-card {
        width: 140px;
    }

    .search-bar-container {
        display: none;
    }
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .doc-shelf-wrapper {
        margin: 0 -15px;
        padding: 0 15px;
    }

    .shelf-nav {
        display: none !important;
        /* Hide arrows on mobile, use touch scroll */
    }
}

/* 
   User Request: Only show arrows if 6+ files.
   Using :has() to check if there is a 6th child.
   If NOT 6th child, hide nav.
*/
.doc-shelf-wrapper:not(:has(.doc-card:nth-child(6))) .shelf-nav {
    display: none !important;
}

/* --- Back To Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 998;
    /* Below FAB */
    transition: all 0.3s ease;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}