/* ============================================================
   Blarney Stone Operations Dashboard
   Mobile-first responsive design
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ---- HEADER ---- */

header {
    background: #1a1a2e;
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
}

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

/* ---- BUTTONS ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

.btn-send {
    background: #1565C0;
    color: white;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
}

.btn-send:hover {
    background: #0d47a1;
}

.btn-select-all {
    background: #e0e0e0;
    color: #555;
    font-size: 13px;
    padding: 6px 12px;
}

.btn-select-all:hover {
    background: #d0d0d0;
}

.btn-primary {
    background: #1565C0;
    color: white;
    padding: 10px 32px;
    font-size: 15px;
}

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

/* ---- MAIN / GRID ---- */

main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 700px) {
    .actions-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 960px) {
    .actions-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ---- ACTION CARDS ---- */

.action-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-header {
    padding: 16px 20px;
    color: white;
}

.card-header h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 2px;
}

.card-header p {
    font-size: 13px;
    opacity: 0.85;
}

.cig-header {
    background: linear-gradient(135deg, #e65100, #ff9800);
}

.liquor-header {
    background: linear-gradient(135deg, #6a1b9a, #ab47bc);
}

.sales-header {
    background: linear-gradient(135deg, #1565C0, #42a5f5);
}

.slow-header {
    background: linear-gradient(135deg, #2e7d32, #66bb6a);
}

.overpur-header {
    background: linear-gradient(135deg, #c62828, #ef5350);
}

.clearance-header {
    background: linear-gradient(135deg, #ad1457, #f06292);
}

.lowstock-header {
    background: #d84315;
}

.overstock-header {
    background: #4527a0;
}

.card-body {
    padding: 16px 20px 20px;
}

.card-note {
    font-size: 13px;
    color: #777;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* ---- STORE PICKER ---- */

.store-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.store-checkbox {
    cursor: pointer;
}

.store-checkbox input {
    display: none;
}

.store-chip {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 20px;
    border: 2px solid #ddd;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.store-checkbox input:checked + .store-chip {
    background: #1565C0;
    border-color: #1565C0;
    color: white;
}

.store-chip:hover {
    border-color: #1565C0;
}

/* ---- TOGGLE SWITCH ---- */

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #1976d2;
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

/* ---- DATE PICKER ---- */

.date-picker {
    margin-bottom: 16px;
}

.date-picker label {
    display: block;
    font-size: 13px;
    color: #777;
    margin-bottom: 6px;
}

.date-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #333;
}

.date-input:focus {
    border-color: #1565C0;
    outline: none;
}

/* ---- DAY PICKER ---- */

.day-picker {
    margin-bottom: 16px;
}

.day-picker label {
    display: block;
    font-size: 13px;
    color: #777;
    margin-bottom: 6px;
}

.day-picker select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.day-picker select:focus {
    border-color: #1565C0;
    outline: none;
}

/* ---- CARD ACTIONS ---- */

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ---- MODAL ---- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

/* ---- PROGRESS BAR ---- */

.progress-section {
    padding: 28px 24px 20px;
    text-align: center;
}

.progress-bar-track {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #1565C0;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.progress-bar-fill.progress-done {
    background: #2e7d32;
}

.progress-bar-fill.progress-error {
    background: #c62828;
}

.progress-percent {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-top: 16px;
}

.progress-status {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.progress-status-done {
    color: #2e7d32;
    font-weight: 600;
}

.progress-status-error {
    color: #c62828;
    font-weight: 600;
}

/* ---- LOG DETAILS ---- */

.log-details {
    border-top: 1px solid #eee;
}

.log-toggle {
    padding: 10px 20px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    user-select: none;
}

.log-toggle:hover {
    color: #555;
}

.task-output {
    overflow-y: auto;
    padding: 12px 20px;
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
    font-size: 12px;
    line-height: 1.6;
    background: #1a1a2e;
    color: #ccc;
    max-height: 250px;
}

.output-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.output-info {
    color: #64b5f6;
}

.output-success {
    color: #81c784;
    font-weight: bold;
}

.output-error {
    color: #ef5350;
    font-weight: bold;
}

.modal-footer {
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

/* ---- TOAST ---- */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 300;
    animation: slideUp 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.toast-success {
    background: #2e7d32;
}

.toast-error {
    background: #c62828;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- LOGIN ---- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1a2e;
}

.login-card {
    background: white;
    padding: 40px 32px;
    border-radius: 12px;
    text-align: center;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-card h1 {
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-card h2 {
    font-size: 14px;
    color: #888;
    font-weight: 400;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    text-align: center;
}

.login-card input:focus {
    border-color: #1565C0;
    outline: none;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #1565C0;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover {
    background: #0d47a1;
}

.alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.error {
    background: #ffebee;
    color: #c62828;
}

/* Finalize Transfers result */
.finalize-summary {
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #166534;
}
.finalize-ok { color: #6b7280; }
.finalize-err { color: #dc2626; }
.finalize-none {
    padding: 10px 14px;
    color: #6b7280;
    font-size: 14px;
    font-style: italic;
}
.finalize-store {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}
.finalize-store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    background: #f9fafb;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    list-style: none;
    user-select: none;
}
.finalize-store-header::-webkit-details-marker { display: none; }
.finalize-store-header::before {
    content: '▶';
    font-size: 10px;
    margin-right: 8px;
    transition: transform 0.15s;
    color: #6b7280;
}
details[open] .finalize-store-header::before { transform: rotate(90deg); }
.finalize-store-name { color: #111827; }
.finalize-store-meta { color: #6b7280; font-weight: 400; font-size: 13px; }
.finalize-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.finalize-table th {
    text-align: left;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}
.finalize-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.finalize-table tr:last-child td { border-bottom: none; }
