/* Global Variables & Reset */
:root {
    --primary-color: #006400;
    /* Dark Green */
    --secondary-color: #FFD700;
    /* Gold */
    --accent-color: #004d00;
    /* Darker Green for hover */
    --bg-color: #F4F7F6;
    --text-color: #333;
    --white: #fff;
    --light-grey: #e0e0e0;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--accent-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #000;
}

.btn-secondary:hover {
    background-color: #e6c200;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

/* Form Styles */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--light-grey);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-family: var(--font-body);
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 100, 0, 0.1);
}

/* Login Page Specifics */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    /* Modern Dark Gradient */
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.98);
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
}

.login-logo {
    width: 100px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.login-header h2 {
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #666;
    margin-bottom: 35px;
    font-size: 0.95em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Enhanced Input Fields for Login */
.login-box input {
    background: #f9f9f9;
    border: 2px solid #eee;
    transition: all 0.3s ease;
}

.login-box input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 100, 0, 0.1);
}

/* User Table Utilities */
.btn-icon {
    border: none;
    background: none;
    padding: 8px;
    cursor: pointer;
    font-size: 1.1em;
    transition: transform 0.2s, background 0.2s;
    border-radius: 6px;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.05);
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-header h3 {
    color: white;
    margin-left: 10px;
    font-size: 1.2em;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul li a {
    display: block;
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95em;
    border-left: 4px solid transparent;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--secondary-color);
}

.main-content {
    flex: 1;
    background: #f4f7f6;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-area {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info h4 {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-info .number {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-icon {
    font-size: 2em;
    color: var(--secondary-color);
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        height: 100%;
        z-index: 1000;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .login-box {
        margin: 20px;
    }
}

/* Payment Field Styling */
.currency-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    font-weight: bold;
    z-index: 10;
}

.currency-input-wrapper input {
    padding-left: 30px;
    /* Space for symbol */
    margin-bottom: 0;
    /* Override default */
}

/* Yellow Card Template (Hidden by default, shown on Print/Modal) */
#yellowCardModal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.yellow-card-template {
    background: #fff8c4;
    width: 850px;
    /* Increased Width for Landscape */
    max-width: 95%;
    min-height: 540px;
    /* Adjusted Height */
    padding: 30px;
    border: 1px solid #d4c30b;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', sans-serif;
    position: relative;
    color: #000;
    overflow: hidden;
}

.yellow-card-template::before {
    content: "LIBERIA MINISTRY OF HEALTH";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 4em;
    color: rgba(212, 195, 11, 0.1);
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
}

.yc-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.yc-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    /* Slightly wider photo col */
    gap: 30px;
    position: relative;
    z-index: 1;
}

.yc-photo-area {
    border: 2px solid #000;
    height: 170px;
    width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.yc-details .yc-row {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 10px;
    padding-bottom: 3px;
    align-items: flex-end;
}

.yc-label {
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 0.75em;
    color: #000;
    text-transform: uppercase;
    width: 100px;
    flex-shrink: 0;
}

.yc-value {
    font-weight: 700;
    font-size: 1.1em;
    font-family: 'Courier New', Courier, monospace;
    color: #000;
    letter-spacing: 0.5px;
}

.yc-qr-area {
    width: 110px;
    height: 110px;
    border: 1.5px solid #000;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    text-align: center;
    padding: 8px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.05);
}

.yc-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.input-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 576px) {
    .input-row-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal Base Styles */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4em;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: 0.3s;
}

.close-modal:hover {
    color: #333;
}

/* Admin Form Specifics */
.admin-modal {
    width: 750px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

.preview-box {
    width: 100%;
    height: 140px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    overflow: hidden;
    transition: 0.3s;
}

.preview-box span {
    font-size: 0.8em;
    margin-top: 8px;
}

.signature-preview {
    height: 100px;
}

.preview-box:hover {
    border-color: var(--primary-color);
    background: #f0f7f0;
    color: var(--primary-color);
}

/* Settings Grid & Global Responsiveness */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#recordsTable {
    width: 100%;
    min-width: 800px;
    /* Force scrollable area */
}

/* Responsive Overrides */
@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-modal {
        width: 95%;
        padding: 20px;
    }

    .top-bar {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .user-profile {
        width: 100%;
        justify-content: flex-end;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .yellow-card-template {
        padding: 15px;
        width: 100%;
        max-width: 100%;
    }

    .yc-header h2 {
        font-size: 1.4em;
    }

    .yc-grid {
        grid-template-columns: 1fr;
    }

    .yc-photo-area {
        margin: 0 auto 15px;
    }
}


/* Print Specifics */
@media print {
    body * {
        visibility: hidden;
    }

    #yellowCardModal,
    #yellowCardModal * {
        visibility: visible;
    }

    #yellowCardModal {
        position: absolute;
        left: 0;
        top: 0;
        background: white;
    }

    .yellow-card-template {
        box-shadow: none;
        border: 2px solid #000;
        background: #fff8c4 !important;
        /* Ensure background prints if enabled */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print {
        display: none !important;
    }
}