/*
================================================================
DIGITAL DOCUMENT ORGANIZER - STYLESHEET (style.css)
================================================================
This CSS file defines all the colors, layouts, and animations
for our application. It is designed to be beginner-friendly:
- Uses CSS Variables (Custom Properties) to make theme changes easy.
- Uses Flexbox and Grid layouts to ensure a modern responsive design.
- Uses CSS transitions for smooth animations and interactive states.
- Includes a dedicated print stylesheet for PDF exports.
*/

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

/* --- Root Variables (Light Theme System) --- */
:root {
    --font-main: 'Inter', sans-serif;
    
    /* Color Palette */
    --primary: #2563eb;          /* Royal Blue */
    --primary-hover: #1d4ed8;    /* Darker Blue */
    --primary-rgb: 37, 99, 235;
    
    --bg-app: #f8fafc;           /* Light gray/blue canvas background */
    --bg-card: #ffffff;          /* Pure white card backgrounds */
    --bg-input: #ffffff;
    
    --text-main: #0f172a;        /* Deep slate for main text */
    --text-muted: #64748b;       /* Cool gray for secondary text */
    
    --border: #e2e8f0;           /* Soft border gray */
    --border-focus: #3b82f6;     /* Blue border on focus */
    
    /* Expiry Check Colors (Light Mode) */
    --status-safe: #10b981;          /* Emerald Green */
    --status-safe-bg: #ecfdf5;       /* Light Green Tint */
    --status-warning: #f59e0b;       /* Amber/Orange */
    --status-warning-bg: #fffbeb;    /* Light Orange Tint */
    --status-danger: #ef4444;        /* Crimson Red */
    --status-danger-bg: #fef2f2;     /* Light Red Tint */

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.03);
    
    /* Global Transitions */
    --transition-speed: 0.3s;
    --transition-curve: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Theme Variables --- */
body.dark-mode {
    --bg-app: #0f172a;           /* Dark Slate canvas */
    --bg-card: #1e293b;          /* Medium Slate cards */
    --bg-input: #1e293b;
    
    --text-main: #f8fafc;        /* Off-white main text */
    --text-muted: #94a3b8;       /* Silver-gray secondary text */
    
    --border: #334155;           /* Slate border */
    --border-focus: #60a5fa;     /* Lighter blue focus border */
    
    /* Expiry Check Colors (Dark Mode) */
    --status-safe: #34d399;
    --status-safe-bg: rgba(52, 211, 153, 0.1);
    --status-warning: #fbbf24;
    --status-warning-bg: rgba(251, 191, 36, 0.1);
    --status-danger: #f87171;
    --status-danger-bg: rgba(248, 113, 113, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.4);
}

/* --- Global Reset & Basics --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed) var(--transition-curve), 
                color var(--transition-speed) var(--transition-curve);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- Application Container --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex-grow: 1;
}

/* --- HEADER STYLES --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.brand-section {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- Theme Toggle Switch --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}

.theme-switch input {
    display: none; /* Hide default checkbox */
}

.slider {
    background-color: #cbd5e1;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 18px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 18px;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.theme-icon-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-curve);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--status-danger);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* --- DASHBOARD STATISTICS SECTION --- */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.total .stat-icon-wrapper {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.stat-card.expiring .stat-icon-wrapper {
    background-color: var(--status-warning-bg);
    color: var(--status-warning);
}

.stat-card.expired .stat-icon-wrapper {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
}

/* --- VIEW CONTROLLER (SPA View Panels) --- */
.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
    animation: fadeIn var(--transition-speed) var(--transition-curve);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- SEARCH, FILTER & SORT BAR --- */
.controls-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.controls-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-input);
    color: var(--text-main);
    outline: none;
    transition: border-color var(--transition-speed);
}

.search-input:focus {
    border-color: var(--border-focus);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.select-input {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-input);
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    min-width: 160px;
    transition: border-color var(--transition-speed);
}

.select-input:focus {
    border-color: var(--border-focus);
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- DOCUMENT LIST GRID --- */
.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* Document Card Design */
.doc-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed) var(--transition-curve);
    position: relative;
}

.doc-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.3);
}

/* Expiry indicator bar at the top of card */
.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--card-status-color, var(--border));
}

.doc-thumbnail-container {
    width: 100%;
    height: 180px;
    background-color: #f1f5f9;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .doc-thumbnail-container {
    background-color: #0f172a;
}

.doc-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed);
}

.doc-card:hover .doc-thumbnail {
    transform: scale(1.05);
}

/* Placeholder Graphic style */
.doc-placeholder-icon {
    font-size: 48px;
    color: var(--text-muted);
    opacity: 0.5;
}

.doc-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.doc-card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.doc-category {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.doc-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta-list {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    list-style: none;
}

.doc-meta-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.doc-meta-label {
    font-weight: 500;
}

.doc-meta-value {
    color: var(--text-main);
    font-family: monospace;
    font-size: 13.5px;
}

.doc-card-actions {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* Empty State Container */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-muted);
    opacity: 0.6;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.empty-state-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto;
}

/* --- ADD / EDIT DOCUMENT FORM VIEW --- */
.form-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    max-width: 700px;
    margin: 0 auto;
}

.form-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-title {
    font-size: 20px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
}

.form-label span.required {
    color: var(--status-danger);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-family: var(--font-main);
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-input);
    color: var(--text-main);
    outline: none;
    transition: all var(--transition-speed);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control.error {
    border-color: var(--status-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

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

/* Image Upload Container Customizer */
.image-upload-wrapper {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: var(--bg-app);
    cursor: pointer;
    transition: border-color var(--transition-speed);
    position: relative;
}

.image-upload-wrapper:hover {
    border-color: var(--border-focus);
}

.image-upload-wrapper input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.upload-text {
    font-size: 13px;
    color: var(--text-muted);
}

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

/* Form Action Buttons Container */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 20px;
}

/* Form Inline Error Messages */
.error-msg {
    font-size: 12px;
    color: var(--status-danger);
    font-weight: 500;
    margin-top: 2px;
    display: none;
}

/* Image Upload Preview Panel */
.upload-preview-container {
    margin-top: 10px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    max-height: 200px;
    display: none;
    border: 1px solid var(--border);
}

.upload-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 198px;
    background-color: #000000;
}

.remove-preview-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed);
}

.remove-preview-btn:hover {
    background-color: var(--status-danger);
}

/* --- MODAL BASE STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.65); /* Dark blur cover */
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) var(--transition-curve);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(12px);
    transition: transform var(--transition-speed) var(--transition-curve);
}

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

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-speed);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- VIEW DETAILS MODAL STYLES --- */
.details-header-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.details-preview-container {
    width: 100%;
    max-height: 300px;
    background-color: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .details-preview-container {
    background-color: #0f172a;
}

.details-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 298px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

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

.details-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.details-value {
    font-size: 15px;
    font-weight: 500;
    margin-top: 2px;
}

.details-value-mono {
    font-family: monospace;
    font-size: 15.5px;
    letter-spacing: 0.5px;
}

.details-section-title {
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-bottom: 8px;
    text-transform: uppercase;
    color: var(--primary);
    margin-top: 16px;
}

.details-notes-box {
    background-color: var(--bg-app);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap;
    border-left: 3px solid var(--primary);
}

.expiry-indicator-card {
    grid-column: 1 / -1;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

/* --- CUSTOM CONFIRM DIALOG MODAL --- */
.confirm-modal-container {
    max-width: 420px;
    text-align: center;
}

.confirm-icon {
    font-size: 48px;
    color: var(--status-danger);
    margin-bottom: 16px;
}

.confirm-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.confirm-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.toast {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    cursor: pointer;
}

.toast.toast-success {
    border-left-color: var(--status-safe);
}

.toast.toast-error {
    border-left-color: var(--status-danger);
}

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: slideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* --- FOOTER STYLES --- */
footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 40px;
}

/* --- RESPONSIVE LAYOUT FOR MEDIUM SCREENS --- */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        max-width: none;
    }
    
    .controls-left {
        flex-direction: column;
        align-items: stretch;
    }
    
    .select-input {
        width: 100%;
    }
}

/* --- PRINT-SPECIFIC CSS (FOR EXPORTING TO PDF) --- */
@media print {
    /* Hide everything on the page except the printable modal body */
    body * {
        visibility: hidden;
    }
    
    /* Center and make the details visible */
    #detailsModal, 
    #detailsModal * {
        visibility: visible;
    }
    
    #detailsModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background-color: white !important;
        color: black !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    /* Remove modal wrappers, overlays, scrolls for print */
    .modal-overlay {
        position: absolute;
        background-color: transparent !important;
        backdrop-filter: none !important;
        padding: 0;
    }
    
    .modal-container {
        max-width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
        background-color: white !important;
        color: black !important;
    }
    
    .modal-header {
        border-bottom: 2px solid #000000 !important;
        padding: 10px 0 !important;
    }
    
    .modal-close,
    .modal-footer,
    .form-actions {
        display: none !important; /* Hide print actions/close buttons */
    }
    
    .modal-body {
        padding: 20px 0 !important;
        overflow: visible !important;
    }
    
    /* Ensure high contrast labels */
    .details-label {
        color: #555555 !important;
        font-weight: 700;
    }
    
    .details-value {
        color: #000000 !important;
    }
    
    .details-notes-box {
        border: 1px solid #cccccc !important;
        border-left: 4px solid #000000 !important;
        background-color: #f9f9f9 !important;
        color: #000000 !important;
    }
    
    /* Print status tag properly */
    .details-header-tag {
        border: 1px solid #000 !important;
        color: #000 !important;
        background-color: #fff !important;
    }
    
    .expiry-indicator-card {
        border: 1px solid #000 !important;
        background-color: #f9f9f9 !important;
        color: #000 !important;
    }
    
    /* Preview image handling in print */
    .details-preview-container {
        border: 1px solid #ccc !important;
        background-color: #fff !important;
        page-break-inside: avoid;
    }
    
    .details-preview-img {
        max-height: 250px !important;
    }
}
