/*
|--------------------------------------------------------------------------
| Worker Tracker - Global Styles
|--------------------------------------------------------------------------
*/

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background: #f6f7f9;
    color: #1f2937;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}


/* ==========================================================================
   Common Container
   ========================================================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}


/* ==========================================================================
   Admin Layout
   ========================================================================== */

.admin-page {
    min-height: 100vh;
    padding: 20px;
}

.admin-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}


/* ==========================================================================
   Header
   ========================================================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
}

.page-subtitle {
    margin: 5px 0 0;
    font-size: 14px;
    color: #6b7280;
}


/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.card-title {
    margin: 0 0 15px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}


/* ==========================================================================
   Dashboard Grid
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
}

.stat-label {
    margin-bottom: 7px;
    font-size: 13px;
    color: #6b7280;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
}


/* ==========================================================================
   Action Grid
   ========================================================================== */

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.action-card {
    display: block;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.action-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.action-title {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.action-description {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.btn-primary {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.btn-primary:hover {
    background: #000000;
    border-color: #000000;
}

.btn-secondary {
    background: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn-danger {
    background: #ffffff;
    border-color: #ef4444;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fef2f2;
}

.btn-success {
    background: #ffffff;
    border-color: #22c55e;
    color: #15803d;
}

.btn-success:hover {
    background: #f0fdf4;
}

.btn-small {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
}


/* ==========================================================================
   Forms
   ========================================================================== */

.form-card {
    max-width: 800px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 22px;
}

.form-group {
    margin-bottom: 17px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.form-control,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.form-textarea {
    min-height: 110px;
    resize: vertical;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.12);
}

.form-help {
    margin-top: 5px;
    font-size: 12px;
    color: #6b7280;
}

.required {
    color: #dc2626;
}


/* ==========================================================================
   Form Row
   ========================================================================== */

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}


/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}


/* ==========================================================================
   Tables
   ========================================================================== */

.table-card {
    width: 100%;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.table th,
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid #eef0f2;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

.table th {
    background: #f9fafb;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.table td {
    color: #374151;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tr:hover td {
    background: #fafafa;
}


/* ==========================================================================
   Status
   ========================================================================== */

.status {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #f3f4f6;
    color: #6b7280;
}


/* ==========================================================================
   Links
   ========================================================================== */

.text-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

.break-link {
    word-break: break-all;
}


/* ==========================================================================
   Action Group
   ========================================================================== */

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}


/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    padding: 40px 20px;
    text-align: center;
}

.empty-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #374151;
}

.empty-description {
    margin: 0 0 16px;
    font-size: 13px;
    color: #6b7280;
}


/* ==========================================================================
   Link Box
   ========================================================================== */

.link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.link-box input {
    flex: 1;
    min-width: 0;
}


/* ==========================================================================
   Public Report
   ========================================================================== */

.public-page {
    min-height: 100vh;
    padding: 20px 14px;
}

.public-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.public-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}


/* ==========================================================================
   Report Statistics
   ========================================================================== */

.stats-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.7;
}

.stats-separator {
    margin: 0 9px;
    color: #c4c7cc;
    font-weight: 400;
}


/* ==========================================================================
   Date Filters
   ========================================================================== */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    background: #ffffff;
    color: #4b5563;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.filter-link:hover {
    background: #f9fafb;
}

.filter-link.active {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}


/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #6b7280;
}

.text-danger {
    color: #dc2626;
}

.text-success {
    color: #15803d;
}

.text-bold {
    font-weight: 700;
}

.mt-0 {
    margin-top: 0;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.w-100 {
    width: 100%;
}


/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */

@media (max-width: 900px) {

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .container,
    .admin-container {
        padding-left: 15px;
        padding-right: 15px;
    }
}


/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */

@media (max-width: 600px) {

    .admin-page {
        padding: 12px 10px;
    }

    .public-page {
        padding: 12px 10px;
    }

    .container,
    .admin-container {
        padding-left: 0;
        padding-right: 0;
    }

    .page-header {
        align-items: flex-start;
    }

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .card {
        padding: 15px;
        border-radius: 10px;
    }

    .form-card {
        padding: 15px;
        border-radius: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 23px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .btn {
        min-height: 38px;
        padding: 0 12px;
        font-size: 13px;
    }

    .actions {
        gap: 5px;
    }

    .public-card {
        padding: 15px;
        border-radius: 10px;
    }

    .stats-line {
        font-size: 14px;
    }

    .stats-separator {
        margin: 0 6px;
    }

    .filter-link {
        min-height: 36px;
        padding: 0 12px;
        font-size: 12px;
    }
}


/* ==========================================================================
   Very Small Devices
   ========================================================================== */

@media (max-width: 380px) {

    .stats-line {
        font-size: 13px;
    }

    .filter-link {
        padding: 0 10px;
    }

    .page-title {
        font-size: 18px;
    }
}