/* =========================================
   Global
   ========================================= */
body {
    font-family: 'Prompt', sans-serif;
}

/* =========================================
   Card
   ========================================= */
.card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
    border: 1px solid #e5e7eb;
}

.card-body {
    padding: 1.25rem;
}

/* =========================================
   Buttons
   ========================================= */
/* Base button styles — shared by .btn and all .btn-* variants */
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    font-family: 'Prompt', sans-serif !important;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s !important;
    cursor: pointer !important;
    text-decoration: none !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled,
.btn-danger:disabled,
.btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #2563eb !important;
    color: #fff !important;
    border: none !important;
}
.btn-primary:hover:not(:disabled) { background-color: #1d4ed8 !important; }

.btn-secondary {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}
.btn-secondary:hover:not(:disabled) { background-color: #e5e7eb !important; }

.btn-success {
    background-color: #16a34a !important;
    color: #fff !important;
    border: none !important;
}
.btn-success:hover:not(:disabled) { background-color: #15803d !important; }

.btn-danger {
    background-color: #dc2626 !important;
    color: #fff !important;
    border: none !important;
}
.btn-danger:hover:not(:disabled) { background-color: #b91c1c !important; }

.btn-warning {
    background-color: #f59e0b !important;
    color: #fff !important;
    border: none !important;
}
.btn-warning:hover:not(:disabled) { background-color: #d97706 !important; }

.btn-sm {
    padding: 0.25rem 0.625rem !important;
    font-size: 0.75rem !important;
}

/* Table action buttons — larger tap target, full-width stacked layout */
.btn-table {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8rem !important;
}

.btn-lg {
    padding: 0.625rem 1.5rem !important;
    font-size: 0.9375rem !important;
    border-radius: 0.625rem !important;
}

/* =========================================
   Form elements
   ========================================= */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-input {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #111827;
    font-family: 'Prompt', sans-serif;
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input::placeholder { color: #9ca3af; }

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / .2);
}

.form-input:disabled {
    background-color: #f9fafb;
    color: #6b7280;
}

.form-select {
    appearance: none;
    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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

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

.form-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* =========================================
   Table
   ========================================= */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

table.data-table {
    min-width: 100%;
    border-collapse: collapse;
}

table.data-table thead tr {
    background-color: #f9fafb;
}

table.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

table.data-table tbody tr:hover {
    background-color: #f9fafb;
}

table.data-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
}

table.data-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f3f4f6;
}

/* =========================================
   Stat cards
   ========================================= */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .1);
    border: 1px solid #e5e7eb;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* =========================================
   Sidebar (Admin)
   ========================================= */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.sidebar-link.active {
    background-color: #2563eb;
    color: #fff;
}

.sidebar-link.active:hover {
    background-color: #1d4ed8;
    color: #fff;
}

.sidebar-link i {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

/* =========================================
   Dropzone
   ========================================= */
.dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

/* =========================================
   Force hide for modal overlays and JS-toggled dropdowns.
   Do NOT use `.hidden` globally — it would block Tailwind's
   responsive variants (md:flex, sm:block, etc.).
   ========================================= */
.fixed.hidden {
    display: none !important;
}
#userMenu.hidden,
#mobileMenu.hidden {
    display: none !important;
}

/* =========================================
   Badge
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* =========================================
   Pagination
   ========================================= */
.page-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    background-color: #fff;
    color: #374151;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
}

.page-btn:hover:not(:disabled) { background-color: #f9fafb; }

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-btn.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* =========================================
   Loading spinner
   ========================================= */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   Tab navigation (work-types modal)
   ========================================= */
.tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
    transition: color 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
    color: #6b7280;
}

.tab-btn.tab-active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-btn:hover:not(.tab-active) {
    color: #374151;
}

/* =========================================
   Flash message (auto-dismiss)
   ========================================= */
.flash-msg {
    animation: fadeOut 0.4s ease 4s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; pointer-events: none; }
}

/* =========================================
   Responsive tweaks
   ========================================= */
@media (max-width: 767px) {
    /* Stat cards stack vertically on mobile */
    .stat-card {
        padding: 1rem;
    }

    /* Responsive table → card list */
    .data-table thead { display: none; }

    .data-table tbody tr {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 0.625rem;
        margin: 0.625rem 0.75rem;
        padding: 0.25rem 0;
        background: #fff;
        box-shadow: 0 1px 2px rgb(0 0 0 / .06);
    }

    .data-table tbody tr:not(:last-child) td { border-bottom: none; }

    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
        border-bottom: 1px solid #f3f4f6;
        text-align: right;
    }

    .data-table tbody td:last-child { border-bottom: none; }

    /* Hide empty cells with no label */
    .data-table tbody td[data-label]::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Action cell — full width, centered */
    .data-table tbody td.td-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.625rem 0.875rem;
        background: #f9fafb;
        border-radius: 0 0 0.625rem 0.625rem;
    }

    /* First cell (name/title) — larger, left-aligned */
    .data-table tbody td.td-primary {
        font-size: 0.9rem;
        font-weight: 600;
        color: #111827;
        justify-content: flex-start;
        flex-direction: column;
        align-items: flex-start;
        padding-top: 0.75rem;
        padding-bottom: 0.625rem;
        border-bottom: 1px solid #e5e7eb;
    }

    /* Remove table-wrapper overflow on mobile so cards show shadow */
    .table-wrapper { overflow-x: visible; border: none; }
}
