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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header & Navigation */
.navbar {
    background-color: #1a472a;
    padding: 1rem 2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-right a {
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
}

.navbar-right a:hover {
    color: #ffc107;
}

.user-info {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: 0.5rem;
}

.sidebar-backdrop {
    display: none;
}

/* Off-screen honeypot field for the public application form (bots that
   fill every field will trip this; real users never see or touch it) */
.hp-field {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.question-block {
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.question-block:last-child,
.checklist-item:last-child {
    border-bottom: none;
}

.app-footer {
    padding: 1.5rem 2rem;
    color: #666;
    font-size: 0.85rem;
    border-top: 1px solid #ddd;
    background: white;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a472a 0%, #2d6a42 100%);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1a472a;
}

.login-box .company-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #1a472a;
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #1a472a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #0f2819;
}

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

.btn.btn-success {
    background-color: #28a745;
}

.btn.btn-danger {
    background-color: #dc3545;
}

.btn.btn-warning {
    background-color: #ffc107;
    color: #333;
}

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

.btn-block {
    width: 100%;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ddd;
}

.dashboard-header h1 {
    color: #1a472a;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #1a472a;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2d6a42;
}

.card-text {
    color: #666;
    font-size: 0.9rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background-color: #1a472a;
    color: white;
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.table tbody tr:hover {
    background-color: #f9f9f9;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Forms */
.form-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-section h2 {
    color: #1a472a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

textarea:focus {
    outline: none;
    border-color: #1a472a;
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

/* Sidebar Navigation */
.sidebar {
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
    min-height: calc(100vh - 60px);
    padding: 1rem 0;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #e8f4f8;
    border-left-color: #1a472a;
    color: #1a472a;
}

.main-content {
    flex: 1;
}

.layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.layout .sidebar {
    width: 250px;
    overflow-y: auto;
}

.layout .main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* File Upload */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #1a472a;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-input-label:hover {
    background-color: #0f2819;
}

/* Canvas for Digital Signature */
canvas {
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: crosshair;
    display: block;
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        justify-content: flex-start;
    }

    .navbar-right {
        margin-left: auto;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .layout .main-content {
        padding: 1.25rem;
    }

    /* Off-canvas sidebar: slides in over content instead of stacking above it */
    .layout .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.25s ease;
        box-shadow: 2px 0 8px rgba(0,0,0,0.2);
        background-color: #fff;
    }

    body.sidebar-open .layout .sidebar {
        left: 0;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-right span {
        font-size: 0.85rem;
    }

    .main-content,
    .card,
    .form-section {
        padding: 1rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .app-footer {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .navbar,
    .sidebar,
    .sidebar-backdrop,
    .app-footer,
    .btn,
    .no-print {
        display: none;
    }

    .card,
    .form-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .letterhead,
    .letterhead * {
        color: #000 !important;
    }

    body.print-document {
        font-size: 12pt;
        color: #000;
        background: white;
    }
}

/* Company letterhead used by the chrome-free print templates (appointment
   letters / affidavits). Shown on-screen too, since that page doubles as a
   print-preview before the user actually prints it. */
.letterhead {
    display: block;
    text-align: center;
    border-bottom: 2px solid #000;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.letterhead-logo {
    max-height: 110px;
    width: auto;
    margin: 0 auto 0.5rem;
    display: block;
}

.letterhead-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
}

/* A4 print sizing for generated documents (appointment letters, affidavits,
   exit paperwork). @page controls the real printed margins; .a4-page mimics
   the A4 proportions on screen so the page doubles as a print-preview. */
@page {
    size: A4;
    margin: 15mm;
}

.a4-page {
    max-width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 15mm;
    background: white;
    color: #1a1a1a;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media print {
    .a4-page {
        box-shadow: none;
        padding: 0;
        min-height: auto;
        max-width: none;
    }

    /* When two documents appear on one page (e.g. appointment letter +
       affidavit shown together after onboarding), print each on its own
       sheet instead of running them together. */
    .a4-page + .a4-page {
        page-break-before: always;
    }
}

/* On-screen spacing between two documents shown one after another
   (mirrors the print page-break above, so the preview looks similar). */
.a4-page + .a4-page {
    margin-top: 2rem;
}

.doc-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #000;
    text-align: center;
    font-size: 0.8rem;
    color: #333;
}
