/* WHC Universal Stylesheet */
/* ------------------------------------------------------------- */
/* Use this file on all PHP pages with:
   <link rel="stylesheet" href="whc.css">
   ------------------------------------------------------------- */

/* Layout & Global */
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    margin: 0;
    padding: 20px;
}

/* Headers */
h1, h2, h3 {
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Header Bar */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #0f172a;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.header-bar h1 {
    margin: 0;
    font-size: 1.8em;
    color: #fff;
}

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

/* Header Dropdown Menu */
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-dropdown {
    position: relative;
    display: inline-block;
}

.header-dropdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.header-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-dropdown-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.header-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    margin-top: 8px;
    z-index: 1000;
    overflow: hidden;
}


.header-dropdown-item {
    display: block;
    width: 100%;
    padding: 13px 16px;
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.01em;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.header-dropdown-item:last-child {
    border-bottom: none;
}

.header-dropdown-item:hover {
    background-color: #f8fafc;
    color: #0369a1;
}

.header-dropdown-item.header-dropdown-admin {
    color: #0284c7;
    font-weight: 600;
}

.header-dropdown-item.header-dropdown-admin:hover {
    background-color: #e0f2fe;
}

.header-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
}

/* Content Container */
.content-container {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

/* Buttons */
.btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease-in-out;
    font-weight: 600;
}

.btn-primary {
    background-color: #0f172a;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #1e293b;
}

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

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #b91c1c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #991b1b;
}

/* Main Table Styling */
#purchaseTable, .form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
    font-size: 14px;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#purchaseTable thead th,
.form-table th {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
    padding: 10px;
    border-bottom: 2px solid #1e293b;
}

#purchaseTable tbody td,
.form-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
}

#purchaseTable tbody tr:nth-child(even),
.form-table tr:nth-child(even) {
    background-color: #f9fafb;
}

#purchaseTable tbody tr:nth-child(odd),
.form-table tr:nth-child(odd) {
    background-color: #f1f5f9;
}

#purchaseTable tbody tr:hover,
.form-table tr:hover {
    background-color: #e2e8f0;
    transition: background-color 0.2s ease-in-out;
}

#purchaseTable tfoot td {
    background-color: #0f172a !important;
    color: #ffffff !important;
    font-weight: bold;
    text-align: center;
    padding: 10px;
}

/* Positive and Negative Cells */
.green-cell {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    font-weight: bold;
}

.red-cell {
    background-color: #fee2e2 !important;
    color: #7f1d1d !important;
    font-weight: bold;
}

/* Buttons for Edit/Delete */
.edit-btn {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.edit-btn:hover {
    background-color: #1d4ed8;
}

/* Unified, accessible delete button style for the whole site */
.delete-btn {
    background-color: #cc0000; /* vivid red */
    color: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.12s ease, transform 0.06s ease, box-shadow 0.12s ease;
}

.delete-btn:hover {
    background-color: #a30000; /* darker red */
}

.delete-btn:active {
    transform: translateY(1px);
}

/* Focus-visible for keyboard users */
.delete-btn:focus, .delete-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18);
}

/* Date Header */
.date-header {
    background: #1e293b !important;
    color: #ffffff !important;
    font-weight: 600;
    text-align: left;
    padding: 10px;
    border-top: 2px solid #0f172a;
}

/* Inputs and Form Controls */
.form-control {
    width: 100%;
    padding: 6px 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 4px rgba(15, 23, 42, 0.3);
}

/* Weight Inputs Layout (Orders.php) */
.weight-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.weight-inputs input {
    width: 70px;
}

.weight-label {
    font-size: 0.9em;
    margin-left: 2px;
    margin-right: 6px;
    white-space: nowrap;
}
/* Smaller weight inputs */
.add-form input[name="lbs"],
.add-form input[name="oz"] {
    width: 70px;
    text-align: right;
    font-size: 13px;
    padding: 2px 4px;
}

/* Smaller cost and payment method inputs */
.add-form input[name="cost"] {
    width: 90px;
    text-align: right;
    font-size: 13px;
    padding: 2px 4px;
}

.add-form select[name="paymentMethod"] {
    width: auto;
    min-width: 120px;
    max-width: 180px;
    font-size: 13px;
    padding: 3px 6px;
}
/* Responsive */
@media screen and (max-width: 768px) {
    .form-table th, .form-table td,
    #purchaseTable th, #purchaseTable td {
        font-size: 12px;
        padding: 6px;
    }

    .btn {
        font-size: 12px;
        padding: 4px 8px;
    }

    .form-control {
        font-size: 13px;
    }
}
/* --- Add Form Styling --- */
.add-form {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.add-form h2 {
    font-size: 1.2em;
    color: #0f172a;
    margin-bottom: 12px;
}

.add-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.add-form label {
    font-weight: 600;
    font-size: 0.9em;
    color: #1e293b;
}

.add-form input,
.add-form select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.add-form input:focus,
.add-form select:focus {
    border-color: #0f172a;
    outline: none;
    box-shadow: 0 0 4px rgba(15, 23, 42, 0.25);
}

.add-form button {
    margin-top: 10px;
    padding: 8px 14px;
    font-weight: 600;
}

/* --- Header Bar Primary Button Contrast Fix --- */
.header-bar .btn-primary {
    background-color: #1d4ed8;
    color: #ffffff;
}

.header-bar .btn-primary:hover {
    background-color: #1e40af;
}

/* --- Refined Add Form Layout for purchases.php (3-line layout) --- */
.add-form {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    font-size: 13px;
}

.add-form h2 {
    font-size: 1.1em;
    color: #0f172a;
    margin-bottom: 10px;
}

.add-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.add-form .form-row > div {
    flex: 1 1 30%;
    min-width: 160px;
}

/* Weight inputs aligned cleanly */
.weight-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weight-inputs input {
    width: 60px;
    text-align: right;
}

/* Smaller font and labels */
.add-form label {
    font-weight: 600;
    font-size: 0.85em;
    color: #1e293b;
}

.add-form input,
.add-form select {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
}

.add-form input:focus,
.add-form select:focus {
    border-color: #0f172a;
    outline: none;
    box-shadow: 0 0 4px rgba(15, 23, 42, 0.25);
}

/* Buttons */
.add-form button {
    margin-top: 10px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
}

/* --- Simple Output Table Styling (matches crewMembers.php) --- */
.simpleOutput table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

.simpleOutput thead th {
    background-color: #0f1e33;
    color: #fff;
    font-weight: 600;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #1e293b;
}

.simpleOutput tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.simpleOutput tbody tr:nth-child(even) {
    background-color: #f1f5f9;
}

.simpleOutput tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.simpleOutput tbody tr:hover {
    background-color: #e2e8f0;
    transition: background-color 0.15s;
}

.simpleOutput .total-row td {
    font-weight: bold;
    color: #0f1e33;
    background-color: #f1f5f9;
    border-top: 2px solid #e5e7eb;
}

.simpleOutput .grand-total-row td {
    font-weight: bold;
    color: #fff;
    background-color: #0f1e33;
    border-top: 2px solid #0f1e33;
}

.simpleOutput .delete-btn {
    background-color: #991b1b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.15s;
}

.simpleOutput .delete-btn:hover {
    background-color: #7f1d1d;
}

/* Work Log table: match crewMembers.php table styles (comfortable spacing) */
.worklog-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem; /* match crewMembers */
    box-shadow: 0 0 5px rgba(0,0,0,0.05);
}

.worklog-table thead th {
    background-color: #003366; /* match crewMembers header color */
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 2px solid #1e293b;
}

.worklog-table tbody td {
    padding: 0.5rem 0.5rem; /* comfortable spacing like crewMembers */
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    font-size: 0.95rem;
}

.worklog-table tbody tr:nth-child(odd) {
    background-color: #f9fbff;
}
.worklog-table tbody tr:nth-child(even) {
    background-color: #e6f0ff;
}

.worklog-table tbody tr:hover {
    background-color: #e2e8f0;
    transition: background-color 0.15s;
}

/* Inputs and inline editors inside worklog table to match crewMembers sizing */
.worklog-table tbody td input[type="text"],
.worklog-table tbody td input[type="number"],
.worklog-table tbody td select,
.worklog-table tbody td textarea {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.15rem 0.3rem;
    border: 1px solid #99bbff;
    border-radius: 3px;
    box-sizing: border-box;
    background: #fff;
}

.worklog-table tbody td .actions button,
.worklog-table .delete-btn,
.worklog-table .edit-btn {
    background-color: #0055cc;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    margin-right: 0.3rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.worklog-table .delete-btn { background-color: #cc3300; }
.worklog-table .delete-btn:hover { filter: brightness(85%); }
.worklog-table .edit-btn:hover { filter: brightness(85%); }

.worklog-table .total-row td {
    font-weight: bold;
    color: #0f1e33;
    background-color: #f1f5f9;
    border-top: 2px solid #e5e7eb;
}

.worklog-table .grand-total-row td {
    font-weight: bold;
    color: #fff;
    background-color: #0f1e33;
    border-top: 2px solid #0f1e33;
}

/* Responsive: collapse padding slightly on small screens */
@media screen and (max-width: 720px) {
    .worklog-table thead th {
        padding: 0.6rem 0.4rem;
        font-size: 0.9rem;
    }
    .worklog-table tbody td {
        padding: 0.4rem 0.4rem;
        font-size: 0.9rem;
    }
}

/* iPhone / very small screen adjustments: hide management UI and make content compact */
@media screen and (max-width: 480px) {
    /* Hide admin/management controls entirely on small screens */
    .header-actions,           /* top-right header buttons */
    .actions,                  /* table action cells */
    .delete-btn,               /* delete buttons */
    .edit-btn,                 /* edit buttons */
    .btn-secondary,            /* secondary/manage buttons */
    .btn-danger,               /* danger/manage buttons */
    .admin-only,               /* any explicit admin-only wrapper */
    form[id^="add"],         /* add forms (addWorkDayForm, addCrewMemberForm, etc) */
    .add-form,                 /* add-form blocks */
    .manage-controls,         /* generic manage controls */
    .worklog-page form,        /* worklog add/edit forms */
    .crew-page form            /* crew member add/edit forms */
    {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Make header compact */
    .header-bar {
        padding: 10px 12px;
        border-radius: 6px;
    }
    .header-bar h1 { font-size: 1.1rem; }

    /* Reduce global padding for mobile */
    body { padding: 8px; }
    .content-container { padding: 12px; }

    /* Tables: allow horizontal scrolling rather than squishing */
    table, .form-table, #purchaseTable { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table thead, table tbody, table tr, table th, table td { display: table; width: 100%; box-sizing: border-box; }

    /* Reduce font sizes for denser layout */
    .btn { font-size: 12px; padding: 6px 8px; }
    .form-control, input, select, textarea { font-size: 13px; }

    /* Ensure message area is not too large */
    #message { font-size: 0.95rem; padding: 8px; }
}

/* Utility: visually hidden (for screen readers) */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; /* added line */
}

/* Confirmation modal (site-wide) */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.confirm-modal-overlay.active { display: flex; }
.confirm-modal {
    background: #fff;
    border-radius: 8px;
    width: 420px;
    max-width: calc(100% - 32px);
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.confirm-modal h2 {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    color: #0f172a;
}
.confirm-modal p {
    margin: 0 0 12px 0;
    color: #334155;
}
.confirm-modal .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.confirm-modal .btn-cancel {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #111827;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.confirm-modal .btn-confirm {
    background: #cc0000;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
