@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

/* ==========================================================================
   GLIDE SYSTEM VARIABLES
   ========================================================================== */
* {
    /* Fonts mapped to your imports */
    --headingfont: 'Google Sans', sans-serif;
    --textfont: 'Figtree', sans-serif;

    /* Glide Signature Palette */
    --primary: #0066ff;
    --primary-hover: #0052cc;
    --primary-light: #e6f0ff;
    --bg-main: #f9fafb;
    --border-color: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    
    /* Soft Radius & Shadows */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0; /* Changed to 0 so the top navbar hugs the edges perfectly */
    background: var(--bg-main);
    font-family: var(--textfont);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Add padding inside canvas wrappers below the navbar instead */
.container, .page, .main-content {
    margin-top: 24px;
}

/* ==========================================================================
   TOP NAVIGATION BAR (Integrated Component)
   ========================================================================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 0 24px;
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Left Side: Logo & Text */
.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Google Material Symbols UI Styling */
.nav-logo-icon {
    color: var(--primary);
    font-size: 26px !important;
    user-select: none;
}

.nav-title {
    font-size: 18px;
    font-weight: 600;
    font-family: var(--headingfont);
    color: var(--text-main);
    letter-spacing: -0.3px;
}

/* Right Side: Navigation Links */
.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* Primary Navigation Button Accent */
.nav-link.primary {
    background-color: var(--primary);
    color: #ffffff;
}

.nav-link.primary:hover {
    background-color: var(--primary-hover);
}

/* ==========================================================================
   MAIN CONTAINERS (Glide App Canvas Layout)
   ========================================================================== */
.container {
    width: calc(100% - 48px); /* Margins account for layout offset */
    max-width: 1600px;
    margin: 24px auto;
    background: white;
    padding: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.page {
    width: calc(100% - 48px);
    max-width: 1200px;
    margin: 24px auto;
    background: white;
    padding: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1 {
    margin-top: 0;
    margin-bottom: 12px;
    font-family: var(--headingfont);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-family: var(--headingfont);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-main);
}

/* TOP SECTION (Inside Page/Container content headers) */
.top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

/* ==========================================================================
   TABLES (Polished Data Grid Look)
   ========================================================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.salary-table {
    min-width: 1450px;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    text-align: left;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 15px;
    color: var(--text-main);
}

tr:hover td {
    background: #f8fafc;
}

/* TABLE INPUTS */
.salary-table input {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-family: var(--textfont);
    background: white;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.salary-table input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* READONLY UIF FIELD */
.salary-table .uif {
    background: #f3f4f6;
    color: var(--text-muted);
    cursor: not-allowed;
}

/* NUMBER COLUMNS */
.salary-number {
    text-align: right;
    white-space: nowrap;
}

/* TOTAL ROW */
.salary-total td {
    background: #f9fafb;
    font-weight: 700;
    font-size: 16px;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

/* HIGHLIGHTED CALCULATION ROW */
.salary-highlight td {
    background: #fef9c3;
    color: #713f12;
    font-weight: 700;
    font-size: 16px;
}

/* ==========================================================================
   BUTTONS (Pill/Rounded Modern UI Blocks)
   ========================================================================== */
button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--textfont);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* PRINT BUTTON */
.print-button {
    background: #1f2937;
    color: white;
    width: 100%;
    min-width: 120px;
    padding: 12px;
    font-size: 14px;
}

.print-button:hover {
    background: #111827;
}

.secondary-button {
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.secondary-button:hover {
    background: #e5e7eb;
}

/* ACTION CONTROLS GROUP */
.salary-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   FORMS & INPUT FIELDS
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    font-size: 15px;
    font-family: var(--textfont);
    background: white;
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ==========================================================================
   MODALS (Clean Glass/Overlay UI)
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal-box {
    width: 100%;
    max-width: 500px;
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ==========================================================================
   ALERTS / NOTIFICATIONS
   ========================================================================== */
.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   PAYSLIP MODULE
   ========================================================================== */
.payslip {
    max-width: 900px;
    margin: auto;
    background: white;
    padding: 48px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.payslip-header {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.payslip-section {
    margin-bottom: 32px;
}

.payslip-signature {
    margin-top: 64px;
    border-top: 1px dashed var(--border-color);
    padding-top: 16px;
    display: inline-block;
    min-width: 200px;
}

/* UTILITIES */
.payslip-toolbar {
    width: 100%;
    max-width: 900px;
    margin: auto;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE LAYOUT RESPONSIVENESS
   ========================================================================== */
@media(max-width:1200px){
    .container, .page {
        width: calc(100% - 32px);
        padding: 24px;
    }
    .top-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    h1 {
        font-size: 28px;
    }
}

@media(max-width:700px){
    .top-nav {
        padding: 0 16px;
    }
    .nav-title {
        font-size: 16px;
    }
    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    .salary-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    button {
        width: 100%;
    }
}

/* ==========================================================================
   PRINT OPTIMIZATION
   ========================================================================== */
@media print {
    body {
        background: white;
        padding: 0;
    }
    .no-print, .top-nav {
        display: none !important; /* Hides navbar on print view automatically */
    }
    .payslip {
        border: none;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
        box-shadow: none;
    }
    @page {
        size: A4;
        margin: 12mm;
    }
}

/* ==========================================================================
   CLOCK IN / OUT SHEET LAYOUT EXTENSION
   ========================================================================== */
.clock-screen-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 24px;
}

/* Modifies the .page canvas into a crisp, standalone compact card */
.page.clock-card {
    width: 100%;
    max-width: 460px; /* Forces dynamic mobile viewport sizing */
    margin: 0;
    padding: 40px 32px;
}

/* User Profile Badge UI Block */
.staff-profile-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 28px;
}

.profile-avatar-icon {
    font-size: 36px !important;
    color: var(--text-muted);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Action Button Overhaul */
.clock-submit-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    margin-top: 8px;
}

.clock-submit-btn .material-symbols-rounded {
    font-size: 20px;
}

/* Version Footnote Text Layout */
.footer-version {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.1px;
}

/* Mobile Tweak overrides */
@media (max-width: 500px) {
    .page.clock-card {
        padding: 32px 20px;
        border: none;
        box-shadow: none;
        background: transparent; /* Seamless blend on compact smartphone widths */
    }
}