/* =========================================================
   1. DRAG AND DROP FILE UPLOAD ZONES
   ========================================================= */
.qhse-file-drop-zone {
    position: relative;
    border: 2px dashed #94a3b8;
    border-radius: 6px;
    padding: 25px 20px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Added :focus-within for keyboard accessibility and CSS variables for dynamic theming */
.qhse-file-drop-zone:hover,
.qhse-file-drop-zone:focus-within {
    border-color: var(--qhse-primary, #005A9C);
    background: #f0f9ff;
    outline: 2px dashed var(--qhse-primary, #005A9C);
    outline-offset: 4px;
}

/* Hide the default ugly file input, but stretch it over the box so it's clickable */
.qhse-file-drop-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.qhse-file-drop-zone .qhse-file-label {
    font-size: 14px;
    color: #475569;
    font-weight: 600;
    pointer-events: none; /* Prevents text from blocking the click */
}

.qhse-file-drop-zone .qhse-file-icon {
    font-size: 28px;
    margin-bottom: 8px;
    pointer-events: none;
}

/* =========================================================
   2. DASHBOARD METRIC CARDS
   ========================================================= */
.qhse-metric-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qhse-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.qhse-metric-title {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.qhse-metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 5px;
}

/* =========================================================
   3. GLOBAL BUTTON STYLES
   ========================================================= */
.qhse-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 14px;
}

/* Updated to use dynamic theme variables */
.qhse-btn--primary {
    background: var(--qhse-primary, #005A9C);
    color: white;
}

.qhse-btn--primary:hover {
    background: var(--qhse-primary-hover, #004a80);
    box-shadow: 0 4px 10px rgba(0, 90, 156, 0.2);
    transform: translateY(-1px);
}

.qhse-btn--full {
    width: 100%;
}

/* =========================================================
   4. TOAST NOTIFICATIONS (Flash Messages)
   ========================================================= */
.qhse-toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    font-weight: 600;
    font-size: 14px;
    z-index: 99999;
    /* Slides up instantly, then fades out after 4 seconds */
    animation: qhse-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards, qhse-fade-out 0.5s ease forwards 4s;
    pointer-events: none; /* Allows users to click things behind the toast */
}

.qhse-toast--success { 
    background: #dcfce7; 
    color: #166534; 
    border: 1px solid #bbf7d0; 
}

.qhse-toast--error { 
    background: #fee2e2; 
    color: #991b1b; 
    border: 1px solid #fecaca; 
}

/* Animation Keyframes */
@keyframes qhse-slide-up {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes qhse-fade-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); visibility: hidden; }
}

/* =========================================================
   5. RESPONSIVE & ACCESSIBILITY FIXES
   ========================================================= */

/* Mobile Optimization for Toasts */
@media (max-width: 480px) {
    .qhse-toast {
        left: 20px;
        right: 20px;
        bottom: 20px;
        text-align: center;
        box-sizing: border-box; /* Ensures padding doesn't overflow screen */
    }
}

/* Accessibility: Respect OS "Reduce Motion" Settings */
@media (prefers-reduced-motion: reduce) {
    .qhse-toast {
        animation: none;
        opacity: 1; /* Keep it fully visible since it won't slide in */
    }
    
    .qhse-metric-card:hover,
    .qhse-btn--primary:hover {
        transform: none; /* Disable hover jumps */
    }
    
    .qhse-file-drop-zone {
        transition: none; /* Disable color fade transitions */
    }
}