﻿/* PosDayManagement.razor.css
   Scoped styles for the POS Day Management page.
   Uses RTL layout (dir="rtl" on the root element or body).
*/

/* ── Page shell ───────────────────────────────────────────── */
.pos-day-page {
    direction: rtl;
    padding: 1.5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    font-family: 'Segoe UI', 'Tajawal', sans-serif;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #1a1a1a);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
    margin: 4px 0 0;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

    .btn:active {
        transform: scale(0.97);
    }

    .btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.btn-primary {
    background: #1D4ED8;
    color: #fff;
    border-color: #1D4ED8;
}

    .btn-primary:hover:not(:disabled) {
        background: #1e40af;
    }

.btn-secondary {
    background: transparent;
    color: var(--text-primary, #1a1a1a);
    border-color: #d1d5db;
}

    .btn-secondary:hover {
        background: #f3f4f6;
    }

.btn-danger {
    background: #DC2626;
    color: #fff;
    border-color: #DC2626;
}

    .btn-danger:hover {
        background: #b91c1c;
    }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    transition: background 0.15s;
}

    .btn-icon:hover {
        background: #f3f4f6;
    }

.btn-close-shift {
    color: #DC2626;
}

    .btn-close-shift:hover {
        background: #fef2f2;
    }

/* ── Metrics grid ────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--surface-1, #f9fafb);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 0.5px solid var(--border, #e5e7eb);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    font-weight: 400;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

    .metric-value.sm {
        font-size: 16px;
    }

    .metric-value.accent {
        color: #1D4ED8;
    }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-open {
    background: #dcfce7;
    color: #166534;
}

.badge-closed {
    background: #f3f4f6;
    color: #374151;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    padding: 0 6px;
    margin-right: 6px;
}

/* ── Section ─────────────────────────────────────────────── */
.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-primary, #111827);
}

    .section-title .ti {
        font-size: 18px;
        color: #6b7280;
    }

/* ── Shifts table ────────────────────────────────────────── */
.shifts-table-wrapper {
    overflow-x: auto;
    border: 0.5px solid var(--border, #e5e7eb);
    border-radius: 10px;
}

.shifts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .shifts-table thead th {
        background: var(--surface-1, #f9fafb);
        padding: 10px 14px;
        text-align: right;
        font-weight: 500;
        color: var(--text-secondary, #6b7280);
        font-size: 12px;
        border-bottom: 0.5px solid var(--border, #e5e7eb);
        white-space: nowrap;
    }

    .shifts-table tbody tr {
        border-bottom: 0.5px solid var(--border, #e5e7eb);
        transition: background 0.1s;
    }

        .shifts-table tbody tr:last-child {
            border-bottom: none;
        }

        .shifts-table tbody tr:hover {
            background: #f9fafb;
        }

        .shifts-table tbody tr.row-closed {
            opacity: 0.7;
        }

    .shifts-table td {
        padding: 12px 14px;
        color: var(--text-primary, #111827);
        vertical-align: middle;
    }

        .shifts-table td.num {
            text-align: left;
            font-variant-numeric: tabular-nums;
            font-family: 'Courier New', monospace;
            font-size: 13px;
        }

            .shifts-table td.num.accent {
                color: #1D4ED8;
                font-weight: 600;
            }

/* User cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Day closes list ─────────────────────────────────────── */
.closes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.close-card {
    background: var(--surface-2, #fff);
    border: 0.5px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}

.close-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.close-time {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.close-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.type-day {
    background: #fef3c7;
    color: #92400e;
}

.type-shift {
    background: #e0e7ff;
    color: #3730a3;
}

.close-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.close-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.close-stat-label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
}

.close-stat-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #111827);
}

/* ── Empty states ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary, #6b7280);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.empty-state h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #374151);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

.empty-shifts {
    text-align: center;
    padding: 2rem;
    background: var(--surface-1, #f9fafb);
    border: 0.5px dashed var(--border, #d1d5db);
    border-radius: 10px;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
}

    .empty-shifts .ti {
        font-size: 28px;
        display: block;
        margin-bottom: 8px;
    }

/* ── Dialogs ─────────────────────────────────────────────── */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.dialog {
    background: var(--surface-2, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    direction: rtl;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 0.5px solid var(--border, #e5e7eb);
}

    .dialog-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary, #111827);
    }

.dialog-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dialog-footer {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 1rem 1.25rem;
    border-top: 0.5px solid var(--border, #e5e7eb);
    flex-direction: row-reverse;
}

/* ── Form elements ───────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group label {
        font-size: 13px;
        font-weight: 500;
        color: var(--text-primary, #374151);
    }

.form-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary, #111827);
    background: var(--surface-2, #fff);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    direction: rtl;
}

    .form-input:focus {
        outline: none;
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    }

/* ── Summary grid (inside dialogs) ──────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    background: var(--surface-1, #f9fafb);
    border-radius: 8px;
    padding: 12px;
    border: 0.5px solid var(--border, #e5e7eb);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

    .summary-item span {
        color: var(--text-secondary, #6b7280);
    }

    .summary-item strong {
        font-weight: 600;
        color: var(--text-primary, #111827);
    }

/* ── Alert ───────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

    .alert .ti {
        margin-top: 1px;
        flex-shrink: 0;
    }

.alert-warning {
    background: #fffbeb;
    border: 0.5px solid #fbbf24;
    color: #92400e;
}

/* ── Dark mode ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .btn-secondary:hover {
        background: #374151;
    }

    .btn-icon:hover {
        background: #374151;
    }

    .shifts-table tbody tr:hover {
        background: #1f2937;
    }

    .form-input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    .btn-close-shift {
        border: 1px solid #DC2626 !important;
    }
}
