/*=========================
DESIGN TOKENS
=========================*/

:root {
    --color-primary: #1e3a5f;
    --color-primary-dark: #14283f;
    --color-primary-light: #2d5a8f;
    --color-accent: #f39c12;
    --color-accent-dark: #c9820a;

    --color-success: #2e7d32;
    --color-success-dark: #256428;
    --color-success-bg: #e8f5e9;
    --color-danger: #c62828;
    --color-danger-bg: #fdecea;
    --color-warning: #f9a825;
    --color-warning-bg: #fff8e1;

    --color-surface: #ffffff;
    --color-surface-alt: #f4f6f8;
    --color-surface-alt-dark: #e6e9ec;
    --color-border: #e0e0e0;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;

    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 14px rgba(0,0,0,.10);
}

/*=========================
BASE
=========================*/

html {
    font-size: 14px;
}

@media (min-width:768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    background: var(--color-surface-alt);
    color: var(--color-text);
    font-family: 'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
}

/*=========================
FOCUS
=========================*/

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(30,58,95,.15);
    border-color: var(--color-primary-light);
}

/*=========================
PAGE
=========================*/

.page-container {
    width: 100%;
    margin: 5px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: var(--shadow-sm);
}

/*=========================
PAGE HEADER
=========================*/

.page-header {
    background: var(--color-primary);
    color: #fff;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    padding: 14px 10px;
}

/*=========================
BODY
=========================*/

.page-body {
    background: var(--color-surface);
    padding: 18px 20px;
}

/*=========================
FORM
=========================*/

.form-group {
    margin-bottom: 10px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0;
}

.col-form-label {
    padding-top: 7px;
    padding-bottom: 7px;
}

.form-control,
.form-select {
    height: 34px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
}

textarea.form-control {
    height: 90px;
}

.form-control[readonly] {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

/*=========================
BUTTON
=========================*/

.btn {
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

    .btn-primary:hover,
    .btn-primary:focus {
        background: var(--color-primary-dark);
        border-color: var(--color-primary-dark);
    }

.btn-secondary {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}

    .btn-secondary:hover,
    .btn-secondary:focus {
        background: var(--color-surface-alt-dark);
        border-color: var(--color-border);
        color: var(--color-text);
    }

.btn-success {
    min-width: 70px;
    height: 32px;
    padding: 4px 14px;
    background: var(--color-success);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

    .btn-success:hover {
        background: var(--color-success-dark);
    }

/*=========================
SECTION HEADER
=========================*/

.section-header {
    margin-top: 18px;
    background: var(--color-surface-alt);
    color: var(--color-primary);
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius-sm);
}

/*=========================
GRID
=========================*/

.table {
    margin-bottom: 0;
    font-size: 16px;
}

    .table thead th {
        background: var(--color-primary);
        color: #fff;
        text-align: center;
        vertical-align: middle;
        padding: 8px 6px;
        font-size: 15px;
        font-weight: 600;
    }

    .table tbody td {
        text-align: center;
        vertical-align: middle;
        padding: 6px;
        font-size: 14px;
    }

    .table tbody tr:hover {
        background: var(--color-surface-alt);
    }

.table-bordered > :not(caption) > * > * {
    border: 1px solid var(--color-border);
}

/*=========================
EDIT / DELETE BUTTON
=========================*/

.btn-warning {
    background: var(--color-warning);
    border: none;
    color: #000;
    font-size: 15px;
    padding: 4px 12px;
}

.btn-danger {
    font-size: 15px;
    padding: 4px 12px;
}

/*=========================
ALERTS
=========================*/

.alert-danger {
    background: var(--color-danger-bg);
    border-color: #f5c6cb;
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-bg);
    border-color: #c3e6cb;
    color: var(--color-success);
}

/*=========================
DETAIL CARD (record view, e.g. View Employee)
=========================*/

.detail-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--color-surface-alt);
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

    .detail-card-header .photo-preview,
    .detail-card-header .photo-placeholder {
        width: 64px;
        height: 64px;
        font-size: 28px;
        border-radius: 50%;
    }

.detail-card-identity {
    flex: 1 1 200px;
}

.detail-card-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--color-text);
}

.detail-card-code {
    color: var(--color-text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-card-actions {
    display: flex;
    gap: 8px;
}

.badge-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.badge-status-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-status-inactive {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/*=========================
SEARCH SUGGESTIONS (typeahead dropdown)
=========================*/

.search-box-wrapper {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 320px;
    overflow-y: auto;
}

.search-suggestion-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background: var(--color-surface-alt);
}

.search-suggestion-name {
    font-weight: 600;
    color: var(--color-text);
}

.search-suggestion-code {
    color: var(--color-text-muted);
    font-size: .85em;
}

.search-suggestion-meta {
    margin-left: auto;
    color: var(--color-text-muted);
    font-size: .85em;
    white-space: nowrap;
}

.search-suggestion-highlight {
    background: var(--color-warning);
    color: var(--color-text);
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

/*=========================
PAGINATION
=========================*/

.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0 4px;
}

.page-link {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 14px;
}

    .page-link:hover {
        background: var(--color-surface-alt);
        color: var(--color-primary-dark);
    }

.page-link-disabled {
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    cursor: default;
}

.page-info {
    font-size: 14px;
    color: var(--color-text-muted);
}

.detail-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

    .detail-section:last-child {
        border-bottom: none;
    }

.detail-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px 20px;
}

.detail-item-wide {
    grid-column: span 2;
}

.detail-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    color: var(--color-text);
    word-break: break-word;
    min-height: 18px;
}

@media (max-width: 600px) {
    .detail-item-wide {
        grid-column: span 1;
    }

    .detail-card-header {
        justify-content: center;
        text-align: center;
    }

    .detail-card-code {
        justify-content: center;
    }

    .detail-card-actions {
        width: 100%;
        justify-content: center;
    }
}

/*=========================
FORM ROW
=========================*/

.row {
    margin-bottom: 0;
}

.mb-3 {
    margin-bottom: 6px !important;
}

/*=========================
TAB BUTTON ROW
(the horizontal strip of tab buttons at the top of a
multi-tab form, e.g. Employee Registration)
=========================*/

.tab-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/*=========================
DASHBOARD CARDS
=========================*/

.dashboard-welcome {
    padding: 6px 2px 18px;
}

    .dashboard-welcome h2 {
        color: var(--color-primary);
        font-weight: 700;
        margin-bottom: 4px;
    }

    .dashboard-welcome p {
        color: var(--color-text-muted);
        margin-bottom: 0;
    }

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.dashboard-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: transform .15s, box-shadow .15s;
}

    .dashboard-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        color: var(--color-text);
    }

.dashboard-card-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    font-size: 22px;
}

.dashboard-card-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.dashboard-card-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
}

/*==========================
  TOP BAR
==========================*/

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 1000;
    color: white;
}

.menu-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.15);
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.company-name {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
}

.header-title {
    color: white;
    font-size: 20px;
    font-weight: 600;
}

/*==========================
  SIDEBAR
==========================*/

.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 250px;
    height: calc(100vh - 70px);
    background: var(--color-primary-dark);
    transition: .3s;
    overflow-y: auto;
}

    .sidebar.hide {
        left: -250px;
    }

    .sidebar ul {
        list-style: none;
        padding: 15px;
        margin: 0;
    }

        .sidebar ul li {
            margin-bottom: 8px;
        }

            .sidebar ul li a {
                display: block;
                text-decoration: none;
                color: rgba(255,255,255,.9);
                padding: 12px 15px;
                border-radius: var(--radius-sm);
                transition: .15s;
            }

                .sidebar ul li a:hover {
                    background: var(--color-primary-light);
                    color: #fff;
                }

                .sidebar ul li a.active-parent {
                    color: #fff;
                }

                .sidebar ul li a.active {
                    background: var(--color-accent);
                    color: var(--color-primary-dark);
                    font-weight: 700;
                }

                    .sidebar ul li a.active:hover {
                        background: var(--color-accent);
                        color: var(--color-primary-dark);
                    }

        .sidebar ul ul {
            padding-left: 18px;
        }

/*==========================
  LOGOUT
==========================*/

.logout {
    position: absolute;
    bottom: 20px;
    width: 100%;
    padding: 15px;
}

    .logout a {
        display: block;
        text-decoration: none;
        color: var(--color-accent);
        font-weight: bold;
    }

        .logout a:hover {
            color: var(--color-accent-dark);
        }

/*==========================
  CONTENT
==========================*/

.content {
    margin-top: 70px;
    margin-left: 250px;
    padding: 16px;
    transition: .3s;
}

    .content.full {
        margin-left: 0;
    }

/*DROPDOWN CSS*/

.employee-search-box {
    position: relative;
}

.employee-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 250px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    display: none;
    z-index: 9999;
    box-shadow: var(--shadow-md);
}

.employee-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-surface-alt);
    font-size: 14px;
}

    .employee-item:hover {
        background: var(--color-surface-alt);
    }

/*=========================
PHOTO PREVIEW
=========================*/

.photo-preview,
.photo-placeholder {
    width: 120px;
    height: 140px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.photo-preview {
    object-fit: cover;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-alt);
    font-size: 48px;
    color: var(--color-text-muted);
}

/*=========================
AUTH (Login) PAGE
=========================*/

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 32px 28px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

    .auth-brand .auth-title {
        color: var(--color-primary);
        font-size: 20px;
        font-weight: 700;
        letter-spacing: .3px;
        margin-bottom: 2px;
    }

    .auth-brand .auth-subtitle {
        color: var(--color-text-muted);
        font-size: 13px;
    }

.auth-card label {
    display: block;
    margin-bottom: 6px;
}

.auth-card .form-control {
    height: 42px;
    margin-bottom: 16px;
}

.auth-card .btn-primary {
    width: 100%;
    height: 42px;
    font-weight: 600;
}

/*==========================
  MOBILE
==========================*/

@media (max-width:768px) {

    .sidebar {
        left: -250px;
    }

        .sidebar.hide {
            left: 0;
        }

    .content {
        margin-left: 0;
        padding: 12px;
    }

    .top-bar {
        height: 60px;
        padding: 0 15px;
    }

    .company-name {
        font-size: 16px;
    }

    .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .page-container {
        width: 100%;
        margin: 0 0 12px;
    }

    .page-header {
        font-size: 20px;
    }

    .page-body {
        padding: 14px;
    }

    label {
        font-size: 14px;
    }

    .form-control,
    .form-select {
        height: 40px;
        font-size: 15px;
    }

    .table-responsive {
        overflow-x: auto;
    }

    .table {
        min-width: 900px;
    }

        .table thead th {
            font-size: 14px;
            padding: 8px;
        }

        .table tbody td {
            font-size: 14px;
            padding: 6px;
        }

    .btn-success {
        width: 100%;
        height: 40px;
        font-size: 15px;
    }

    /* Stack every label/input form row (the ubiquitous
       `.row > .col-N` pattern used across every form in the app)
       instead of squeezing label and input side by side. */
    .page-body .row.mb-2 > [class*="col-"],
    .page-body .row.mb-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    .page-body .row.mb-2 label,
    .page-body .row.mb-3 label {
        padding-top: 0;
        padding-bottom: 4px;
    }

    .page-body .row.mb-2,
    .page-body .row.mb-3 {
        margin-bottom: 14px !important;
    }

    /* The toolbar row that pairs tab buttons (or a form) with a
       search box - let it wrap to its own line instead of
       squeezing the tab buttons into a sliver of width. */
    .page-body form > .d-flex.justify-content-between,
    .page-body form > .d-flex.justify-content-end {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .tab-button-row {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

        .tab-button-row .btn {
            flex: 0 0 auto;
        }

    .employee-search-box,
    .employee-search-box input {
        width: 100% !important;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 26px 20px;
    }
}

/*=========================
PRINT
=========================*/

@media print {
    .top-bar,
    .sidebar,
    .print-hide {
        display: none !important;
    }

    .content,
    .content.full {
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        background: #fff !important;
        margin: 0 !important;
    }
}

/*=========================
WAGE SLIP (Form XV) PRINT LAYOUT
=========================*/

.wage-slip-print {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #000;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.ws-title,
.ws-subtitle,
.ws-heading {
    text-align: center;
}

.ws-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ws-subtitle {
    font-size: 13px;
    margin-bottom: 4px;
}

.ws-heading {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.ws-field-table,
.ws-footer-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.ws-field-table td,
.ws-footer-table td {
    padding: 4px 6px;
    vertical-align: top;
    font-size: 13px;
}

.ws-label {
    width: 40%;
    font-weight: 600;
}

.ws-value {
    border-bottom: 1px solid #000;
}

.ws-wage-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.ws-wage-table th,
.ws-wage-table td {
    border: 1px solid #000;
    padding: 6px;
    font-size: 11px;
    text-align: center;
    vertical-align: top;
}

.ws-signature {
    margin-top: 40px;
    text-align: right;
    font-size: 13px;
}
