:root {
    /* Modern Theme Variables (Blue/Orange) */
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --secondary: #6B9BD1;
    --accent: #FF8F70;
    --dark: #0F172A;
    --light: #F8FAFC;
    --gray: #64748B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --card-bg: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.6);

    /* Mapping legacy variables to new theme */
    --primary-color: var(--primary);
    --primary-hover: var(--primary-dark);
    --primary-light: #EEF6FF;
    /* Light blue tint */
    --secondary-color: var(--gray);
    --accent-color: var(--accent);
    --success-color: var(--success);
    --danger-color: var(--danger);
    --warning-color: var(--warning);
    --info-color: #3B82F6;
    --dark-color: var(--dark);
    --light-bg: var(--light);
    --white: #FFFFFF;
    --border-color: #E2E8F0;
    --text-primary: var(--dark);
    --text-secondary: var(--gray);

    /* Typography */
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Shadows */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 2px 8px rgba(148, 163, 184, 0.1);
    --shadow-md: 0 8px 24px rgba(148, 163, 184, 0.15);
    --shadow-lg: 0 16px 48px rgba(148, 163, 184, 0.2);
}

/* Global Scrollbar */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Body */
body {
    background-color: var(--light);
    color: var(--dark);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(at 0% 0%, rgba(74, 144, 226, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(255, 143, 112, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Ensure body padding doesn't affect modal centering */
body.modal-open {
    padding-right: 0 !important;
    overflow: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Legacy Header Cleanup - Most of this is now handled by the new Scribd header */
.file-manager-header {
    display: none;
}

.file-manager-header .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    margin-left: auto;
    flex-wrap: wrap;
}

.file-manager-header .header-spacer {
    flex: 1;
    min-width: 20px;
}

/* Buttons */
.btn-primary {
    background: var(--primary) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px 0 rgba(74, 144, 226, 0.39) !important;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.23) !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 14px 0 rgba(74, 144, 226, 0.39) !important;
}

.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 10px 20px;
}

/* FAB Button */
.fab-btn {
    background: var(--primary);
    box-shadow: 0 4px 14px 0 rgba(74, 144, 226, 0.39);
}

.fab-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.23);
}

/* Checkbox */
.form-check-input {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

.form-check-label {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

/* Bulk Actions Toolbar */
.bulk-actions-toolbar {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.bulk-actions-toolbar .bg-light {
    background: var(--white) !important;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.bulk-actions-toolbar #selectedCount {
    color: var(--primary-color);
    font-size: 15px;
    font-weight: 600;
}

.bulk-actions-toolbar .btn-success {
    background: transparent;
    border: 2px solid var(--success-color);
    color: var(--success-color);
    font-weight: 600;
}

.bulk-actions-toolbar .btn-success:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bulk-actions-toolbar .btn-danger {
    background: transparent;
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    font-weight: 600;
}

.bulk-actions-toolbar .btn-danger:hover {
    background: rgba(229, 115, 115, 0.1);
    border-color: #D32F2F;
    color: #D32F2F;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

/* Modal Styling */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 24px 24px 16px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: none;
    padding: 16px 24px 24px;
}

/* Removal of detached wrappers */
.file-manager,
.file-manager-scroll-container {
    display: contents;
    /* Let children sit directly in the container */
}

/* Prevent scrollbar when dropdown is open - allow overflow but hide scrollbar */
.file-manager-scroll-container.dropdown-open {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Hide scrollbar visually when dropdown is open */
.file-manager-scroll-container.dropdown-open::-webkit-scrollbar {
    width: 0px;
    display: none;
}

.file-manager-scroll-container.dropdown-open {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}


.file-manager-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.file-manager-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.file-manager-scroll-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.file-manager-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Grid View */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    justify-content: start;
    /* Left align with header */
    margin-top: 20px;
}

/* List View */
.file-grid.list-view {
    grid-template-columns: 1fr;
    gap: 12px;
}

/* List view item styles are now in the main .file-item override above */

.file-grid.list-view .file-checkbox {
    position: relative;
    top: 0;
    left: 0;
    grid-area: checkbox;
    margin: 0;
    display: none;
}

.file-grid.list-view .file-icon-container {
    margin: 0;
    grid-area: icon;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-grid.list-view .file-icon-container i {
    font-size: 32px !important;
}

.file-grid.list-view .file-icon-img {
    max-width: 48px;
    height: 48px;
}

.file-grid.list-view .file-name {
    grid-area: name;
    min-width: 150px;
    margin: 0;
    text-align: left;
}

.file-grid.list-view .file-name h4 {
    margin-bottom: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.file-grid.list-view .file-info {
    grid-area: size;
    margin: 0;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.file-grid.list-view .file-info .file-size,
.file-grid.list-view .file-info .file-date {
    margin: 0;
    justify-content: flex-start;
    font-size: 12px;
}

.file-grid.list-view .file-info i {
    margin-right: 6px;
    color: var(--primary-color);
}

.file-grid.list-view .file-text-preview {
    grid-area: message;
    min-height: auto;
    margin: 0;
    padding: 6px 12px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.file-grid.list-view .file-text-preview p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.file-grid.list-view .file-status {
    grid-area: timer;
    margin: 0;
    min-width: 90px;
}

.file-grid.list-view .file-status .badge {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.file-grid.list-view .file-actions {
    grid-area: actions;
    margin: 0;
    gap: 8px;
    justify-content: flex-end;
    display: none;
    /* Hide action buttons in list view */
}

.file-grid.list-view .file-options-column {
    grid-area: options;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.file-grid.list-view .file-actions .btn {
    padding: 10px 12px;
    min-width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-grid.list-view .file-actions .btn i {
    margin: 0;
    font-size: 16px;
}

/* File Item Card (Scribd-inspired) */
.file-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 260px;
}

/* Override for list view - horizontal layout */
.file-grid.list-view .file-item {
    display: grid !important;
    grid-template-columns: 30px 50px 1fr 120px 200px 100px 0px 50px;
    grid-template-areas: "checkbox icon name size message timer actions options";
    align-items: center;
    text-align: left;
    padding: 16px 20px;
    gap: 16px;
    min-height: auto;
    height: auto;
    flex-direction: row;
    overflow: visible;
    /* Allow dropdown to overflow */
    position: relative;
}

.file-item:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.file-expired {
    opacity: 0.6;
    filter: grayscale(0.8);
    cursor: default !important;
    pointer-events: none !important;
}

.file-expired img,
.file-expired i {
    pointer-events: none !important;
    -webkit-user-drag: none !important;
}

.file-expired .action-btn:not(.delete-btn) {
    display: none !important;
}

.file-expired .doc-thumbnail img,
.file-expired .doc-thumbnail i {
    filter: blur(2px);
}

.expired-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    border-radius: inherit;
    pointer-events: none;
}

.expired-text {
    background: #EF4444;
    color: white;
    padding: 6px 15px;
    font-weight: 800;
    font-size: 14px;
    border-radius: 50px;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: rotate(-10deg);
    border: 2px solid white;
}


.file-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* Selection Checkbox */
.file-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: none;
}

.file-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

.file-checkbox input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* File Icon */
.file-icon-container {
    margin-bottom: 8px;
    animation: iconBounce 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@keyframes iconBounce {

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

    50% {
        transform: scale(1.05);
    }
}

.file-icon-img {
    max-width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(107, 155, 209, 0.2));
}

/* Font Awesome file icons styling */
.file-icon-container i {
    font-size: 40px !important;
    filter: drop-shadow(0 2px 8px rgba(107, 155, 209, 0.2));
    transition: all 0.3s ease;
}

.file-item:hover .file-icon-container i {
    filter: drop-shadow(0 4px 12px rgba(107, 155, 209, 0.3));
}

/* File Name */
.file-name {
    flex-shrink: 0;
}

.file-name h4 {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
    word-break: break-word;
    font-weight: 600;
    line-height: 1.2;
}

/* File Info */
.file-info {
    margin: 6px 0;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.file-info .file-size,
.file-info .file-date {
    margin: 3px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-info i {
    margin-right: 6px;
    color: var(--primary-color);
}

/* Text Preview */
.file-text-preview {
    margin: 6px 0;
    font-size: 10px;
    color: var(--text-secondary);
    min-height: 28px;
    padding: 5px 8px;
    background: var(--light-bg);
    border-radius: 6px;
    font-style: italic;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-text-preview:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.file-text-preview p {
    margin: 0;
    line-height: 1.5;
}

.file-text-preview .text-muted {
    color: var(--text-secondary) !important;
}

/* Status Badge */
.file-status {
    margin: 6px 0;
    flex-shrink: 0;
}

.file-status .badge {
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge.bg-primary {
    background: var(--primary-color) !important;
    color: var(--white);
}

.badge.bg-danger {
    background: var(--danger-color) !important;
    color: var(--white);
}

/* Kebab Menu Button (Card View) */
.file-kebab-menu {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    display: block;
    /* Always visible in card view */
    overflow: visible;
}

/* Hide kebab menu in list view */
.file-grid.list-view .file-kebab-menu {
    display: none !important;
}

.kebab-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
}

.kebab-btn:hover {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: scale(1.1);
}

.kebab-btn i {
    font-size: 14px;
}

/* Options Column (List View) */
.file-options-column {
    grid-area: options;
    display: none;
    /* Hidden in card view */
    align-items: center;
    justify-content: flex-end;
    position: relative;
    z-index: 10;
}

/* Show options column in list view */
.file-grid.list-view .file-options-column {
    display: flex;
    position: relative;
    z-index: 10;
}

/* Hide action buttons in list view */
.file-grid.list-view .file-actions {
    display: none !important;
}

.file-options-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.file-options-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.file-options-btn i {
    font-size: 16px;
}

/* Dropdown Menu */
.file-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 10000;
    display: none;
    margin-top: 4px;
    padding: 4px 0;
    animation: dropdownFadeIn 0.2s ease;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar on dropdown menu itself */
.file-dropdown-menu::-webkit-scrollbar {
    width: 4px;
}

.file-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.file-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Ensure dropdown is visible in list view */
.file-grid.list-view .file-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 10000;
}

/* Make sure options column can contain the dropdown */
.file-grid.list-view .file-options-column {
    overflow: visible;
}

/* Prevent scrollbars when dropdown is open - hide overflow on scroll container temporarily */
.file-manager-scroll-container.dropdown-open {
    overflow: hidden;
}

.file-dropdown-menu.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

.file-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: none;
    font-size: 13px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.file-dropdown-menu .dropdown-item:hover {
    background: transparent;
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 14px;
    color: var(--primary-color);
}

.file-dropdown-menu .dropdown-item.preview-item {
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.preview-item:hover {
    background: transparent;
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.preview-item i {
    color: var(--primary-color);
}

.file-dropdown-menu .dropdown-item.share-item {
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.share-item:hover {
    background: transparent;
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.share-item i {
    color: var(--primary-color);
}

.file-dropdown-menu .dropdown-item.download-item {
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.download-item:hover {
    background: transparent;
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.download-item i {
    color: var(--primary-color);
}

.file-dropdown-menu .dropdown-item.delete-item {
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.delete-item:hover {
    background: transparent;
    color: var(--text-primary);
}

.file-dropdown-menu .dropdown-item.delete-item i {
    color: var(--primary-color);
}

.file-dropdown-menu .dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}



/* Action Buttons - Hidden in card view, shown only in list view if needed */
.file-actions {
    display: none;
    /* Hidden by default - actions are in dropdown menu */
    gap: 5px;
    justify-content: center;
    margin-top: auto;
    padding-top: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.file-actions .btn {
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 2px solid;
    box-shadow: none;
    background: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.file-actions .btn i {
    margin: 0;
    font-size: 11px;
}

.file-actions .btn-info {
    border-color: var(--info-color);
    color: var(--info-color);
}

.file-actions .btn-info:hover {
    background: rgba(100, 181, 246, 0.1);
    border-color: #42A5F5;
    color: #42A5F5;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-actions .btn-success {
    border-color: var(--success-color);
    color: var(--success-color);
}

.file-actions .btn-success:hover:not(.disabled) {
    background: rgba(124, 179, 66, 0.1);
    border-color: #689F38;
    color: #689F38;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-actions .btn-success.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: transparent;
}

.file-actions .btn-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    display: inline-flex !important;
}

.file-actions .btn-primary:hover {
    background: rgba(107, 155, 209, 0.1);
    border-color: var(--primary-hover);
    color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-actions .btn-danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
    display: inline-block !important;
}

.file-actions .btn-danger:hover {
    background: rgba(229, 115, 115, 0.1);
    border-color: #D32F2F;
    color: #D32F2F;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}



/* Modal */
.modal-backdrop {
    background-color: rgba(44, 62, 80, 0.6) !important;
    backdrop-filter: blur(8px);
}

/* Ensure body doesn't affect modal positioning */
body.modal-open {
    padding-right: 0 !important;
    overflow: hidden;
}

.modal {
    padding: 0 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1055;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal-dialog {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
    width: auto;
    pointer-events: none;
}

.modal-dialog-centered {
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 1rem) !important;
    margin: 0.5rem auto !important;
    transform: none !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    position: relative !important;
    max-width: 600px !important;
}

.modal-dialog-centered::before {
    display: block;
    height: calc(100vh - 1rem);
    content: "";
    flex-shrink: 0;
}

/* Ensure modal is perfectly centered horizontally and vertically */
.modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.modal.show .modal-dialog {
    transform: translate(0, 0) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.modal.show .modal-dialog-centered {
    margin-left: auto !important;
    margin-right: auto !important;
    transform: translate(0, 0) !important;
    position: relative !important;
}

.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    background: var(--white);
    overflow: hidden;
    position: relative;
    pointer-events: auto;
    width: 100%;
    margin: 0 auto;
}

/* Share Options Modal Styles */
#shareOptionsModal .modal-content {
    max-width: 600px;
}

#shareOptionsModal .form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

#shareOptionsModal .form-label i {
    margin-right: 8px;
    color: var(--primary-color);
}

#shareOptionsModal .form-select {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#shareOptionsModal .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(107, 155, 209, 0.25);
}

#shareOptionsModal .form-check-switch {
    margin-bottom: 15px;
}

#shareOptionsModal .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

#shareOptionsModal .form-check-label {
    cursor: pointer;
    user-select: none;
    margin-left: 10px;
    font-weight: 500;
}

#shareOptionsModal #passwordFieldGroup,
#shareOptionsModal #emailFieldGroup {
    margin-top: 12px;
    padding-left: 0;
    animation: slideDown 0.3s ease;
}

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

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

#shareOptionsModal .input-group {
    margin-top: 8px;
}

#shareOptionsModal .input-group .form-control {
    border-radius: 10px 0 0 10px;
    border: 2px solid var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
}

#shareOptionsModal .input-group .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: none;
    z-index: 3;
}

#shareOptionsModal .input-group .btn {
    border-radius: 0 10px 10px 0;
    border: 2px solid var(--border-color);
    border-left: none;
    background: var(--white);
    color: var(--primary-color);
    padding: 10px 15px;
}

#shareOptionsModal .input-group .btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-hover);
}

#shareOptionsModal .input-group .btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(107, 155, 209, 0.25);
    border-color: var(--primary-color);
}

#shareOptionsModal input[type="email"],
#shareOptionsModal input[type="password"] {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#shareOptionsModal input[type="email"]:focus,
#shareOptionsModal input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(107, 155, 209, 0.25);
}

#shareOptionsModal input[type="email"]:invalid:not(:placeholder-shown),
#shareOptionsModal input[type="password"]:invalid:not(:placeholder-shown) {
    border-color: var(--danger-color);
}

#shareOptionsModal small.text-muted {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

#shareOptionsModal #emailValidationError {
    margin-top: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    animation: slideDown 0.3s ease;
}

#shareOptionsModal #emailValidationError i {
    margin-right: 6px;
}

.modal-header {
    background: var(--white);
    color: var(--text-primary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
    line-height: 1.2;
}

.modal-header .btn-close {
    opacity: 0.6;
    width: 24px;
    height: 24px;
    background-size: 14px;
    transition: all 0.2s ease;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    background: var(--white);
    padding: 20px;
}

/* Drop Zone Styling */
#dropZone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px 16px;
    text-align: center;
    background: var(--light-bg);
    transition: all 0.2s ease;
    cursor: pointer;
}

#dropZone:hover {
    border-color: var(--text-secondary);
    background: #f8f9fa;
}

#dropZone.dragover {
    border-color: var(--primary-color);
    border-style: solid;
    background: rgba(107, 155, 209, 0.05);
}

.drop-zone-icon {
    margin-bottom: 8px;
}

.drop-zone-icon i {
    color: var(--text-secondary);
    font-size: 32px;
    opacity: 0.6;
}

.drop-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#dropZone p.text-muted {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

#dropZone .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

#dropZone .btn-outline-primary i {
    margin-right: 8px;
}

/* File Selected Info */
.file-selected-info {
    margin-top: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.file-selected-info .alert {
    background: rgba(124, 179, 66, 0.08);
    border: 1px solid rgba(124, 179, 66, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0;
    font-size: 13px;
}

.file-selected-info .alert-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.file-selected-info .alert i {
    color: var(--success-color);
    font-size: 14px;
}

.file-selected-info .alert span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Small text under drop zone */
#dropZone+small {
    display: block;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

#dropZone+small i {
    color: var(--info-color);
    margin-right: 4px;
}

/* Form Group */
.form-group {
    margin-bottom: 24px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.form-label i {
    color: var(--primary-color);
    margin-right: 8px;
    font-size: 16px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-size: 14px;
    line-height: 1.6;
}

textarea.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Progress Bar Container */
#progressBarContainer {
    margin-top: 20px;
    padding: 12px;
    background: var(--light-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

#progressBarContainer .progress {
    height: 32px;
    background: var(--white);
    border-radius: 16px;
    margin: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#progressBarContainer .progress-bar {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 16px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(107, 155, 209, 0.3);
}

.progress-text {
    color: var(--white);
    font-weight: 600;
}

/* Modal Footer */
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn {
    padding: 6px 16px;
    font-weight: 500;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 1px solid;
}

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

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

.modal-footer .btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.modal-footer .btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Preview Modal */
.preview-modal-content .modal-dialog {
    max-width: 900px;
}

.preview-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.preview-pdf {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 8px;
}

/* Form Controls */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: none;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 13px;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(107, 155, 209, 0.1);
    outline: none;
}

.form-control-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.form-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 6px;
}

.form-label.small {
    font-size: 12px;
    font-weight: 500;
}

/* Progress Bar */
.progress {
    height: 4px;
    background-color: var(--light-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 12px;
    border: none;
}

.progress-bar {
    background: var(--primary-color);
    height: 100%;
    transition: width 0.4s ease-in-out;
    border-radius: 15px 0 0 15px;
    color: var(--white);
    text-align: center;
    font-weight: bold;
}

/* Drop Zone */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light-bg);
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
    transform: scale(1.02);
}

.drop-zone-icon {
    color: var(--primary-color);
}

/* Pagination */
.pagination.d-none {
    display: none;
}

.pagination-container {
    padding: 16px 30px;
    flex-shrink: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.pagination-lg .page-link {
    color: var(--text-primary);
    background-color: var(--white);
    border-color: var(--border-color);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 0 6px;
    border-radius: 12px !important;
    box-shadow: var(--shadow-sm);
}

.pagination-lg .page-link:hover {
    color: var(--white);
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination-lg .active .page-link {
    color: var(--white);
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.pagination-lg .disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dropdown Menu */
.dropdown-menu {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.dropdown-item {
    padding: 10px 16px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 0;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateX(4px);
}

/* Alert Override */
.alert-success {
    background-color: rgba(124, 179, 66, 0.1) !important;
    border-color: var(--success-color) !important;
    color: #558B2F !important;
    border-radius: 12px;
}

/* Upload Modal Styles */
.upload-icon-circle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.file-selected-info {
    margin-top: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

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

    .file-manager-scroll-container {
        padding: 12px 15px;
    }

    /* Smaller file cards on mobile */
    .file-item {
        padding: 12px 14px;
        border-radius: 12px;
    }

    .file-icon-container {
        margin-bottom: 10px;
    }

    .file-icon-img {
        max-width: 50px;
        height: 50px;
    }

    .file-name h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .file-info {
        margin: 8px 0;
        font-size: 11px;
    }

    .file-text-preview {
        margin: 8px 0;
        font-size: 11px;
        padding: 6px 10px;
        min-height: 28px;
    }

    .file-status {
        margin: 8px 0;
    }

    .file-status .badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    .file-actions {
        margin-top: 10px;
        gap: 6px;
    }

    .file-actions .btn {
        width: 32px;
        height: 32px;
        padding: 0;
    }

    .file-actions .btn i {
        font-size: 12px;
    }

    .pagination-container {
        padding: 10px 20px;
    }

    .file-manager {
        margin: 15px 10px;
    }

    .file-manager-header {
        padding: 0 10px;
        margin: 15px auto 0;
    }

    .file-manager-header .d-flex {
        flex-direction: row;
        justify-content: space-between;
        gap: 15px;
        padding: 14px 18px;
        position: relative;
    }

    .file-manager-header .header-left,
    .file-manager-header .header-right {
        flex: 1;
        justify-content: center;
    }

    .file-manager-header .header-center {
        position: relative;
        left: auto;
        transform: none;
        width: 100%;
        text-align: center;
        margin: 10px 0;
        order: 3;
    }

    .file-manager-header .d-flex {
        flex-direction: column;
        align-items: stretch;
    }

    .file-manager-header .header-left,
    .file-manager-header .header-right {
        width: 100%;
        justify-content: center;
    }

    .file-manager-header .header-right {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Smaller button on mobile */
    .file-manager-header .btn-primary {
        padding: 6px 12px;
        font-size: 12px;
    }

    .file-manager-header .btn-primary i {
        font-size: 11px;
    }

    /* Show SHARE FILE button in grid view on small devices (default state) */
    .file-manager-header .header-left {
        display: flex !important;
    }

    /* Hide SHARE FILE button in list view on small devices */
    .file-manager-header.list-view-active .header-left {
        display: none !important;
    }

    /* Hide grid/list toggle button on small devices */
    .file-manager-header .btn-group[role="group"] {
        display: none !important;
    }

    .file-grid.list-view .file-item {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "checkbox"
            "icon"
            "name"
            "size"
            "message"
            "timer"
            "actions";
        display: flex;
    }

    .file-grid.list-view .file-checkbox {
        position: absolute;
        top: 12px;
        left: 12px;
        display: none;
    }

    .file-grid.list-view .file-icon-container {
        margin: 8px auto;
    }

    .file-grid.list-view .file-icon-img {
        max-width: 60px;
        height: 60px;
    }

    .file-grid.list-view .file-name {
        text-align: center;
        max-width: 100%;
    }

    .file-grid.list-view .file-name h4 {
        white-space: normal;
    }

    .file-grid.list-view .file-info {
        align-items: center;
    }

    .file-grid.list-view .file-info .file-size,
    .file-grid.list-view .file-info .file-date {
        justify-content: center;
    }

    .file-grid.list-view .file-text-preview {
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }

    .file-grid.list-view .file-status {
        min-width: auto;
    }

    .file-grid.list-view .file-actions {
        justify-content: center;
        margin-top: 8px;
    }

    .pagination-lg .page-link {
        width: 40px;
        height: 40px;
        margin: 0 4px;
    }

    .btn {
        width: 90%;
        margin-bottom: 10px;
    }

    /* Modal Responsive */
    .modal-dialog,
    .modal-dialog-centered {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal.show .modal-dialog,
    .modal.show .modal-dialog-centered {
        transform: none !important;
    }

    .modal-dialog,
    .modal-dialog-centered {
        margin: 0.5rem auto !important;
        max-width: calc(100% - 1rem) !important;
        transform: none !important;
    }

    .modal.show .modal-dialog,
    .modal.show .modal-dialog-centered {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-title {
        font-size: 15px;
    }

    .modal-body {
        padding: 16px;
    }

    #dropZone {
        padding: 20px 12px;
    }

    .drop-zone-icon i {
        font-size: 28px;
    }

    .drop-text {
        font-size: 13px;
    }

    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100%;
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .file-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Extra small file cards */
    .file-item {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .file-icon-img {
        max-width: 45px;
        height: 45px;
    }

    .file-name h4 {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .file-info {
        font-size: 10px;
        margin: 6px 0;
    }

    .file-text-preview {
        font-size: 10px;
        padding: 5px 8px;
        min-height: 24px;
    }

    .file-status .badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .file-actions .btn {
        width: 30px;
        height: 30px;
        padding: 0;
    }

    .file-actions .btn i {
        font-size: 11px;
    }

    .empty-state-card {
        padding: 30px 20px;
    }

    .file-manager {
        margin: 10px 5px;
        border-radius: 12px;
    }

    .file-manager-header {
        margin: 10px 5px;
    }

    .file-manager-header .d-flex {
        flex-direction: column;
        padding: 12px 16px;
        gap: 12px;
        align-items: stretch;
    }

    .file-manager-header .header-left,
    .file-manager-header .header-right {
        width: 100%;
        justify-content: center;
    }

    .file-manager-header .header-center {
        position: relative;
        left: auto;
        transform: none;
        width: 100%;
        text-align: center;
        margin: 8px 0;
        order: 3;
    }

    .file-manager-header .header-spacer {
        display: none;
    }

    /* Show SHARE FILE button in grid view on extra small devices (default state) */
    .file-manager-header .header-left {
        display: flex !important;
    }

    /* Hide SHARE FILE button in list view on extra small devices */
    .file-manager-header.list-view-active .header-left {
        display: none !important;
    }

    /* Hide grid/list toggle button on extra small devices */
    .file-manager-header .btn-group[role="group"] {
        display: none !important;
    }

    /* Extra small button on very small screens */
    .file-manager-header .btn-primary {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .file-manager-header .btn-primary i {
        font-size: 10px;
    }

    /* Modal Extra Small Screens */
    .modal-dialog,
    .modal-dialog-centered {
        margin: 0.5rem auto !important;
        max-width: calc(100% - 1rem) !important;
        transform: none !important;
    }

    .modal.show .modal-dialog,
    .modal.show .modal-dialog-centered {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-title {
        font-size: 14px;
    }

    .modal-header .btn-close {
        width: 20px;
        height: 20px;
    }

    .modal-body {
        padding: 14px;
    }

    #dropZone {
        padding: 16px 10px;
    }

    .drop-zone-icon i {
        font-size: 24px;
    }

    .drop-text {
        font-size: 12px;
    }

    #dropZone .btn-outline-secondary {
        padding: 5px 12px;
        font-size: 12px;
    }

    textarea.form-control {
        min-height: 80px;
        font-size: 13px;
    }

    .modal-footer {
        padding: 14px 16px;
    }

    .modal-footer .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Upload Modal Specific Styles */
.upload-modal {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

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

/* --- NEW Scribd-Style Doc Card (Ported from resources.css) --- */

/* Reset .file-item styles when used with .doc-card */
.doc-card.file-item {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    min-height: auto !important;
    display: block !important;
}

.doc-card.file-item:hover {
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

.doc-card {
    position: relative;
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
    box-shadow: none;
    transition: transform 0.2s ease;
    cursor: pointer;
    width: 100%;
    max-width: 180px;
    /* Limit width to match resources.php feel */
    margin: 0 auto;
    /* Center in grid cell */
}

/* Thumbnail Container */
.doc-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1.4;
    /* Portrait ratio */
    background: #ffffff;
    border: 1px solid #e0e0e0;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    /* Subtle shadow like paper */
}

/* Hover Effect: Lift and Shadow */
.doc-card:hover .doc-thumbnail {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-4px);
    border-color: #d0d0d0;
}

/* Inner Content (Icon or Image) */
.doc-thumbnail img,
.doc-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Using cover for uniformity, or contain if text readability is priority. User liked 'scribd' style which usually covers. */
    transition: transform 0.4s ease;
}

.doc-card:hover .doc-thumbnail img,
.doc-card:hover .doc-thumbnail canvas {
    transform: scale(1.05);
    /* Subtle zoom */
}

/* Use direct child selector to avoid affecting icons inside .card-actions */
.doc-thumbnail>i {
    font-size: 3.5rem;
    color: #e0e0e0;
    /* Default icon color */
    opacity: 0.9;
    transition: all 0.3s ease;
}

.doc-card:hover .doc-thumbnail>i {
    transform: scale(1.1);
    opacity: 1;
}

/* File Type Color Coding (Bottom Border) */
.type-pdf {
    border-bottom: 4px solid #EF4444 !important;
}

.type-word {
    border-bottom: 4px solid #3B82F6 !important;
}

.type-excel {
    border-bottom: 4px solid #10B981 !important;
}

.type-ppt {
    border-bottom: 4px solid #F59E0B !important;
}

.type-image {
    border-bottom: 4px solid #8B5CF6 !important;
}

.type-archive {
    border-bottom: 4px solid #6B7280 !important;
}

.type-code {
    border-bottom: 4px solid #374151 !important;
}

.type-video {
    border-bottom: 4px solid #EC4899 !important;
}

.type-audio {
    border-bottom: 4px solid #F472B6 !important;
}

.type-text {
    border-bottom: 4px solid #9CA3AF !important;
}

/* File Type Badge (Top Left) */
.doc-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 5;
    letter-spacing: 0.5px;
    backdrop-filter: blur(2px);
}

/* Hide badge when checkbox is visible (hover or selected) - REMOVED */
/* User requested to hide checkbox instead */

/* Quick Actions Overlay (Top Right) */
.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    /* Stack vertically for better access */
    gap: 6px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    pointer-events: none;
    /* Pass through click when hidden */
}

/* ... */

/* Selection Checkbox */
.doc-checkbox {
    display: none !important;
    /* Hidden as requested */
}

.doc-card:hover .doc-checkbox,
.doc-checkbox.selected {
    display: none !important;
}

.doc-card:hover .card-actions {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 13px;
    backdrop-filter: blur(4px);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn.delete-btn:hover {
    background: #DC2626;
    /* Red for delete */
}

/* 'Quick Preview' Bottom Overlay - REMOVED (Replaced by File Info) */
/* .doc-thumbnail::after { content: 'Quick Preview'; ... } */


/* Selection Checkbox (Absolute Positioning) */
.doc-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: none;
    /* Hidden by default, show on hover or selected */
}

.doc-card:hover .doc-checkbox,
.doc-checkbox.selected {
    display: block;
}

.doc-checkbox .form-check-input {
    width: 20px;
    height: 20px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Info Section - Now an Overlay */
.doc-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px;
    background: rgba(30, 41, 59, 0.95);
    /* Dark background */
    color: white;
    transform: translateY(100%);
    /* Start hidden below */
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 20;
    text-align: left;
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.doc-card:hover .doc-info {
    transform: translateY(0);
    /* Slide up on hover */
}


.doc-info h4 {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: auto;
}

/* Metadata text color for dark overlay */
.doc-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    /* Light text */
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.doc-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-meta i {
    font-size: 10px;
    opacity: 0.8;
    color: inherit;
    /* Inherit light color */
}

/* Override Grid for Portrait Cards */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    /* Smaller min-width for portrait */
    gap: 30px;
    /* More gap */
    justify-content: start;
    padding-bottom: 40px;
}


/* --- Selected State Visuals --- */
.doc-card.selected .doc-thumbnail {
    box-shadow: 0 0 0 3px rgba(30, 123, 133, 0.4);
    border-color: var(--primary-color);
}

.doc-card.selected .doc-checkbox {
    display: block;
}

/* Make thumbnail clickable for preview */
.doc-thumbnail {
    cursor: pointer;
}

/* Compact Empty State */
.step-item-compact {
    text-align: center;
    max-width: 150px;
    padding: 10px;
    transition: transform 0.2s ease;
}

.step-item-compact:hover {
    transform: translateY(-5px);
}

.step-icon img {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
}

.step-item-compact:hover .step-icon img {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 12px rgba(30, 123, 133, 0.2));
}

.step-separator {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-top: 20px;
}

/* --- Preview Modal Zoom Controls --- */
.preview-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Hide scrollbars, relying on drag to pan */
    background-color: rgba(0, 0, 0, 0.02);
    cursor: grab;
}

.preview-content-wrapper:active {
    cursor: grabbing;
}

.preview-image {
    max-width: 100%;
    max-height: 80vh;
    /* Default fit */
    transition: transform 0.2s ease-out;
    /* Smooth scale */
    cursor: grab;
}

.preview-image:active {
    cursor: grabbing;
}

.preview-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    gap: 12px;
    z-index: 1060;
    /* Above modal content */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* Hidden by default */
}

/* Show toolbar only when active class is added or hovered (optional) */
.preview-toolbar.active {
    opacity: 1;
    pointer-events: auto;
}

.preview-zoom-btn {
    background: transparent;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.preview-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-zoom-btn i {
    font-size: 1.1rem;
}

/* --- Missing Empty State Steps Styles --- */
.step-card-new {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    height: 100%;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.step-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.01);
}

.step-number {
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 8rem;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.02);
    line-height: 1;
    z-index: 0;
}

.step-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.step-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 24px;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.icon-yellow {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.icon-green {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.step-card-new h4 {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark);
}

.step-card-new p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* Empty State Button */
.empty-state-btn {
    padding: 12px 32px;
    font-size: 1.1rem;
    border-radius: 100px;
    box-shadow: 0 4px 14px 0 rgba(74, 144, 226, 0.39);
}

.empty-state-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(74, 144, 226, 0.23);
}

.empty-state .row .col-lg-4 {
    min-width: 0;
}

.swal2-container {
    z-index: 99999 !important;
}

.cm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    z-index: 1040;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}

.cm-overlay.active {
    display: flex;
    opacity: 1;
}

.cm-modal {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.cm-modal>form {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
    width: 100%;
    flex: 1;
}

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

.cm-body {
    padding: 10px 28px 28px;
    overflow-y: auto;
    flex: 1;
}

.cm-header {
    padding: 24px 28px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.cm-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cm-close:hover {
    background: #f1f5f9;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Body */
.cm-body {
    padding: 10px 28px 28px;
}

/* Custom Dropzone */
.cm-dropzone {
    border: 2px dashed #e2e8f0;
    border-radius: 24px;
    padding: 32px 20px;
    text-align: center;
    background: #ffffff;
    transition: all 0.3s ease;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cm-dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cm-dropzone:hover {
    border-color: #38bdf8;
    background: #f0f9ff;
    transform: translateY(-2px);
}

.cm-dropzone:hover::before {
    opacity: 1;
}

.cm-drop-icon {
    width: 64px;
    height: 64px;
    background: #e0f2fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    font-size: 28px;
    margin: 0 auto 16px;
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.1);
}

.cm-drop-text {
    font-weight: 700;
    color: #334155;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.cm-drop-sub {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.cm-drop-btn {
    background: #0284c7;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    transition: all 0.2s ease;
}

.cm-drop-btn:hover {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(2, 132, 199, 0.4);
}

.cm-meta {
    text-align: center;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Custom Input Group (Security) */
.cm-input-group {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cm-input-row {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    height: 52px;
}

.cm-input-row:last-child {
    border-bottom: none;
}

.cm-input-icon {
    color: #cbd5e1;
    width: 20px;
    margin-right: 14px;
    display: flex;
    justify-content: center;
    transition: color 0.2s;
}

.cm-input-row:focus-within .cm-input-icon {
    color: #64748b;
}

.cm-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: #475569;
    background: transparent;
    font-weight: 500;
}

.cm-input::placeholder {
    color: #94a3b8;
}

/* Custom Toggle Switch */
.cm-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
}

.cm-switch-label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.cm-fire-icon {
    color: #fca5a5;
    margin-right: 14px;
    width: 20px;
    display: flex;
    justify-content: center;
}

.active .cm-fire-icon {
    /* When toggle is on */
    color: #ef4444;
}

.cm-switch {
    display: inline-block;
    width: 40px;
    height: 22px;
    position: relative;
    flex-shrink: 0;
}

.cm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.cm-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.cm-slider {
    background-color: #ef4444;
}

input:checked+.cm-slider:before {
    transform: translateX(18px);
}

/* Footer & Buttons */
.cm-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 24px 28px;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
}

.cm-btn-cancel {
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 12px 28px;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.cm-btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.cm-btn-upload {
    flex: 1;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

.cm-btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
    filter: brightness(1.05);
}

/* File Selected Info in Custom Modal */
.cm-file-info {
    display: none;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 16px;
    margin-top: -8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 600;
}

/* Custom Preview Modal Specifics */
.cm-preview-modal {
    max-width: 900px;
    /* Larger max width */
    width: 95%;
    /* Responsive width */
    height: 90vh;
    /* Fixed height for preview area */
    display: flex;
    flex-direction: column;
}

.cm-preview-body {
    padding: 0;
    /* Remove padding for edge-to-edge preview */
    background: #f8fafc;
    flex: 1;
    overflow: hidden;
    /* Manage overflow internally */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Image Preview Handling */
.preview-content-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    /* Scrollable area */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease-out;
    transform-origin: center center;
}

/* PDF Preview Handling */
.preview-pdf {
    width: 100%;
    height: 100%;
    border: none;
}

/* Zoom Toolbar override for custom modal */
#customPreviewModal .preview-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
}

#customPreviewModal .preview-toolbar.active {
    opacity: 1;
    pointer-events: auto;
}

.preview-zoom-btn {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}


.preview-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- NEW STEP CARDS FOR EMPTY STATE --- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    width: 100%;
}

.step-card-new {
    background: white;
    border-radius: 32px;
    padding: 40px 30px;
    height: 100%;
    position: relative;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 10px 40px rgba(148, 163, 184, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.step-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(148, 163, 184, 0.15);
}

.step-number {
    position: absolute;
    top: -30px;
    right: -10px;
    font-size: 180px;
    font-weight: 800;
    color: #F1F5F9;
    /* Slate-100 */
    line-height: 1;
    z-index: 0;
    pointer-events: none;
}

.step-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.step-icon i {
    font-size: 28px;
    color: white;
}

.step-card-new h4 {
    font-weight: 700;
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 1.25rem;
}

.step-card-new p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* Specific Icon Colors */
.step-icon.icon-blue {
    background: #3B82F6;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.25);
}

.step-icon.icon-yellow {
    background: #F59E0B;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.25);
}


.step-icon.icon-green {
    background: #10B981;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.25);
}

.empty-state-btn {
    background: #0ea5e9;
    /* Sky Blue */
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 100px;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.empty-state-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(14, 165, 233, 0.4);
    background: #0284c7;
    color: white;
}

.empty-state-btn:active {
    transform: translateY(-1px);
}