/* export_attendance_summary.css - Export Dialog Styles */

/* ===================================================================
   OVERLAY AND CONTAINER
   =================================================================== */

.export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.export-overlay * {
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
}

/* force export buttons to hug text and stay left-aligned */
.export-overlay .button-group {
    justify-content: flex-start;
}

.export-overlay .button-group .btn {
    flex: 0 0 auto !important;
    width: fit-content !important;
}

/* --- popup should hug content, not force 550px --- */
.export-popup{
    height: auto !important;     /* override height: 550px */
    max-height: 90vh;
}

/* --- content shouldn't expand to fill leftover space --- */
.export-content{
    flex: 0 1 auto !important;   /* override flex: 1 */
    overflow-y: visible;         /* only scroll if you really need it */
}

/* If you still want scrolling when content is long, use this instead:
.export-content{
    flex: 0 1 auto !important;
    overflow-y: auto;
}
*/

/* ===================================================================
   HEADER
   =================================================================== */

.export-header {
    background-color: #0D882C;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

.export-header-left h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ===================================================================
   CONTENT
   =================================================================== */

.export-content {
    padding: 20px;
    overflow-y: auto;
    background-color: white;
    flex: 1;
}

.export-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===================================================================
   FORM ELEMENTS
   =================================================================== */

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

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: #495057;
}

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

.radio-group-horizontal {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px;
    align-items: center;
}

.report-type-container {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: nowrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: normal;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* tighten the month selector so it doesn't steal horizontal space */
.report-type-container {
    flex-wrap: nowrap; /* keep single row */
}

/* --- remove the 150px minimum and let it size to content --- */
.month-selector{
    min-width: 0 !important;
    width: auto !important;
    flex: 0 0 auto !important;
}

/* --- make the select itself hug its displayed text --- */
.month-selector .form-input{
    width: fit-content;
    max-width: 100%;
}

/* optional: ensure the selector doesn't force layout overflow */
.report-type-container{
    min-width: 0;
}

/* prevent the radio labels from wrapping */
.radio-label,
.radio-label span {
    white-space: nowrap;
}

.form-input {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    color: #495057;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #0D882C;
    box-shadow: 0 0 0 2px rgba(13, 136, 44, 0.1);
}

.input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-container .form-input {
    flex: 1;
}

.password-toggle {
    padding: 6px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.password-toggle:hover {
    background-color: #5a6268;
}

/* ===================================================================
   INFO BOX
   =================================================================== */

.info-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    color: #6c757d;
    font-family: 'Courier New', Monaco, monospace;
}

/* ===================================================================
   MESSAGES
   =================================================================== */

.export-overlay .error-message {
    color: #dc2626;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.export-overlay .error-message.show {
    display: block;
    opacity: 1;
    height: auto;
    margin: 0;
    padding: 8px 12px;
    overflow: visible;
}

.export-overlay .progress-message {
    color: #0D882C;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 8px;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    width: fit-content;
    flex-shrink: 0;
}

.btn-primary {
    background-color: #0D882C;
    color: white;
}

.btn-primary:hover {
    background-color: #0b6f23;
}

.btn-primary:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */

@media (max-width: 768px) {
    .export-popup {
        width: 95%;
        height: auto;
        max-height: 90vh;
    }

    .export-content {
        padding: 15px;
    }

    .button-group {
        flex-wrap: wrap;
    }

    .input-container {
        flex-direction: column;
        align-items: stretch;
    }

    .password-toggle {
        width: 100%;
    }
}

/* ===================================================================
   DARK MODE
   =================================================================== */

@media (prefers-color-scheme: dark) {
    .export-popup {
        background: #343a40;
        color: #f8f9fa;
    }

    .export-content {
        background-color: #343a40;
    }

    .form-group label {
        color: #f8f9fa;
    }

    .form-input {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .info-box {
        background: #495057;
        border-color: #6c757d;
    }

    .info-label {
        color: #f8f9fa;
    }

    .info-value {
        color: #adb5bd;
    }

    .error-message {
        color: #fca5a5;
        background-color: #431a1a;
        border-color: #7f1d1d;
    }

    .progress-message {
        color: #6ee7b7;
        background-color: #064e3b;
        border-color: #047857;
    }
}

/* =================================================================
   MOBILE SHEET TREATMENT — must live at the very end of this file.
   The earlier @media (max-width: 768px) block (around line 342)
   adjusts dimensions but doesn't go full-screen, and several
   file-scope rules (notably the `.export-popup { height: auto
   !important; max-height: 90vh }` at line ~39 and the
   `.export-content { flex: 0 1 auto !important; overflow-y: visible }`
   at line ~45) carry !important and would otherwise outrank a
   normal-priority mobile override. Putting the full-screen overrides
   here, with !important where needed, ensures they win on both
   source order and cascade.

   Also: the global mobile rule from human_resources_ops.css (loaded
   later than this file) does `.button-group { flex-direction:
   column }` and `.btn { width: 100% }`, which leaks into this overlay
   and stacks the Export / Cancel buttons vertically full-width. The
   .export-overlay-scoped overrides at the bottom of this block undo
   that for buttons inside this overlay only.
   ================================================================= */
@media (max-width: 768px) {
    .export-overlay {
        padding: 0;
    }

    .export-popup {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .export-header {
        position: sticky;
        top: 0;
        z-index: 1;
        border-radius: 0;
        flex-shrink: 0;
    }

    /* Override the desktop `flex: 0 1 auto !important; overflow-y:
       visible` so the form scrolls inside the sheet rather than
       being clipped by the now-`overflow: hidden` popup. */
    .export-content {
        flex: 1 !important;
        min-height: 0;
        overflow-y: auto !important;
        padding: 15px;
    }

    /* Override the global hr_ops mobile `.button-group {
       flex-direction: column }`. Buttons in the export overlay are
       short-captioned (Export / Cancel) and fit on one row. The
       earlier file-scope rule `.export-overlay .button-group .btn {
       width: fit-content !important }` already handles the .btn
       width on its own — this only restores the row direction. */
    .export-overlay .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
}
