/* ==========================================================================
   Documents & Digital Library Component Styles - Piuquén
   ========================================================================== */

.documents-management-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 30px;
}

/* Header Card */
.documents-header-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 16px;
    padding: 24px 28px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
}

.documents-header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.documents-header-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.documents-header-left h2 {
    margin: 0 0 4px 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
}

.documents-header-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #94a3b8;
    max-width: 600px;
    line-height: 1.4;
}

/* Client Selection Bar (Admin) */
.client-selection-bar {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
}

.client-selection-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.client-selection-content label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-selection-content select {
    max-width: 400px;
}

/* Stats Summary Grid */
.documents-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.doc-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.doc-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.stat-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Universal Form Control Styling for Documents Section & Modals */
.documents-management-container .form-control,
.custom-modal-body .form-control {
    width: 100%;
    height: 42px;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.documents-management-container select.form-control,
.custom-modal-body select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
}

.documents-management-container textarea.form-control,
.custom-modal-body textarea.form-control {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

.documents-management-container .form-control:focus,
.custom-modal-body .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Toolbar & Filters */
.documents-toolbar {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.toolbar-search-group {
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 280px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 2;
}

.search-input-wrapper input.form-control {
    padding-left: 42px !important;
    height: 42px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    font-size: 0.9rem;
    background: #ffffff;
    width: 100%;
}

.search-input-wrapper input.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.equipment-filter-wrapper {
    min-width: 220px;
}

.view-mode-toggle {
    display: flex;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}

.view-btn {
    background: #ffffff;
    border: none;
    padding: 8px 14px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn.active {
    background: #3b82f6;
    color: #ffffff;
}

/* Category Pills */
.documents-category-pills {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.category-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-pill:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: var(--text-primary);
}

.category-pill.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.2);
}

.category-pill.active i {
    color: #60a5fa !important;
}

/* Document Cards Grid */
.documents-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.document-item-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
    position: relative;
}

.document-item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.doc-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.doc-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.doc-category-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.doc-card-body {
    flex: 1;
}

.doc-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-original-name {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-equipment-badge {
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    max-width: 100%;
}

.doc-equipment-badge span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #94a3b8;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.doc-card-actions {
    display: flex;
    gap: 8px;
}

.btn-doc-action {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-doc-action.btn-view {
    background: #eff6ff;
    color: #2563eb;
}

.btn-doc-action.btn-view:hover {
    background: #dbeafe;
}

.btn-doc-action.btn-download {
    background: #ecfdf5;
    color: #059669;
}

.btn-doc-action.btn-download:hover {
    background: #d1fae5;
}

.btn-doc-action.btn-delete {
    flex: 0 0 36px;
    background: #fef2f2;
    color: #dc2626;
}

.btn-doc-action.btn-delete:hover {
    background: #fee2e2;
}

/* Empty State */
.doc-empty-state {
    text-align: center;
    padding: 60px 20px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
}

.empty-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.doc-empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.doc-empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 420px;
    margin: 0 auto;
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.drop-icon {
    font-size: 2.2rem;
    color: #64748b;
    margin-bottom: 8px;
}

.drop-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.drop-hint {
    font-size: 0.78rem;
    color: #94a3b8;
}

.file-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.file-preview-icon {
    font-size: 1.8rem;
}

.file-preview-details {
    flex: 1;
    overflow: hidden;
}

.file-preview-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
}

.btn-remove-file {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   CUSTOM MODAL SYSTEM (Fixed Centered Overlay & Backdrop)
   ========================================================= */
.custom-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1;
}

.custom-modal-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-modal-dialog.modal-sm { max-width: 420px; }
.custom-modal-dialog.modal-md { max-width: 580px; }
.custom-modal-dialog.modal-lg { max-width: 780px; }
.custom-modal-dialog.modal-xl { max-width: 980px; }

.custom-modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 10px 20px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.custom-modal-header {
    padding: 16px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header-icon {
    font-size: 1.5rem;
}

.custom-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.modal-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.custom-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.custom-modal-footer {
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(12px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (max-width: 768px) {
    .documents-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .documents-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-search-group {
        flex-direction: column;
    }
    .equipment-filter-wrapper {
        width: 100%;
    }
    .custom-modal {
        padding: 10px;
    }
    .custom-modal-dialog {
        max-width: 100% !important;
    }
}
