/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ===== Global Pointer Cursor for Interactive Elements ===== */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
a,
.btn,
.login-btn,
.panel-tab,
.charge-tab,
.admin-tab,
.dept-card,
.power-btn,
select,
[onclick],
table tbody tr[onclick],
table tbody tr[th\:onclick],
.patient-list-table tbody tr,
.admin-table-area tbody tr,
.charge-items-list tbody tr {
    cursor: pointer;
}

/* ===== Login Page - Sparsh Hospital ===== */
.login-body {
    min-height: 100vh;
    background: url('https://images.unsplash.com/photo-1587351021759-3e566b6af7cc?w=1920') center/cover no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}

.login-body * {
    position: relative;
    z-index: 1;
}

.login-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: #1a5276;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    -webkit-text-stroke: 1px #0d3b56;
}

.login-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-buttons {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.login-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    background: rgba(255,255,255,0.9);
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 160px;
    cursor: pointer;
    border: none;
}

.login-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.login-btn .icon {
    font-size: 3rem;
}

.login-form-container {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.login-form-container.active {
    display: flex;
}

.login-form-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.login-form-card h2 {
    text-align: center;
    color: #1a5276;
    margin-bottom: 1.5rem;
}

.login-form-card .form-group {
    margin-bottom: 1rem;
}

.login-form-card .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #555;
}

.login-form-card .form-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.login-form-card .btn-login {
    width: 100%;
    padding: 0.75rem;
    background: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.login-form-card .btn-login:hover {
    background: #1a5276;
}

.login-form-card .close-form {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
}

/* ===== Department Selection Page ===== */
.dept-body {
    min-height: 100vh;
    background: url('https://images.unsplash.com/photo-1587351021759-3e566b6af7cc?w=1920') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dept-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
}

.dept-body * {
    position: relative;
    z-index: 1;
}

.dept-container {
    display: flex;
    gap: 4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.dept-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2.5rem 3rem;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    font-weight: 700;
    font-size: 1.3rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.dept-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.dept-card .dept-icon {
    font-size: 4rem;
}

.power-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* ===== IPD Control Panel ===== */
.ipd-panel {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a6b8a, #2e86ab);
}

.panel-header {
    text-align: center;
    padding: 1rem;
    position: relative;
}

.panel-header h1 {
    color: #0d5c1d;
    font-size: 2rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.panel-header .header-icons {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
}

.panel-tabs {
    display: flex;
    gap: 0;
    background: #f0f0f0;
    padding: 0.5rem 1rem 0;
    border-bottom: 2px solid #ccc;
}

.panel-tab {
    padding: 0.6rem 1.5rem;
    background: #e0e0e0;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.panel-tab:hover {
    background: #d0d0d0;
}

.panel-tab.active {
    background: white;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
    color: #1a5276;
}

.panel-content {
    background: white;
    margin: 0 1rem 1rem;
    padding: 1.5rem;
    border-radius: 0 0 8px 8px;
    min-height: 70vh;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ===== Register Patient Tab ===== */
.register-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
}

.register-form .form-group {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.register-form .form-group label {
    min-width: 110px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
}

.register-form .form-group input,
.register-form .form-group select,
.register-form .form-group textarea {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    font-size: 0.88rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.register-form .form-group input:focus,
.register-form .form-group select:focus,
.register-form .form-group textarea:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
    outline: none;
}

.register-form .form-group textarea {
    height: 60px;
    resize: vertical;
}

.gender-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.gender-options label {
    min-width: auto !important;
    font-weight: normal !important;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.register-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.register-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
}

.patient-list-panel {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.patient-list-panel .search-bar {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #ccc;
}

.patient-list-panel .search-bar label {
    font-weight: 600;
    font-size: 0.9rem;
}

.patient-list-panel .search-bar input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.patient-list-table {
    max-height: 400px;
    overflow-y: auto;
}

.patient-list-table table {
    width: 100%;
    border-collapse: collapse;
}

.patient-list-table th,
.patient-list-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.patient-list-table th {
    background: #2980b9;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.patient-list-table tr:hover {
    background: #e8f4fd;
    cursor: pointer;
}

.patient-list-table tr.selected-row {
    background: #fff3cd !important;
    box-shadow: inset 3px 0 0 #f39c12;
}

.patient-list-table tr.selected {
    background: #bee5fd;
}

/* ===== Billing Tab ===== */
.billing-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.billing-patient-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafe, #f0f4fa);
    border: 1px solid #d8e4f0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.billing-patient-info .info-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.billing-patient-info .info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.billing-patient-info .info-row label {
    min-width: 120px;
    font-weight: 600;
    font-size: 0.82rem;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.billing-patient-info .info-row input,
.billing-patient-info .info-row select {
    flex: 1;
    padding: 0.45rem 0.7rem;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.billing-patient-info .info-row input:focus,
.billing-patient-info .info-row select:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
    outline: none;
}

.billing-buttons-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.billing-buttons-row .btn {
    font-size: 0.85rem;
}

.bill-date-field {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bill-date-field label {
    font-weight: 600;
    font-size: 0.85rem;
}

/* Charge Category Tabs */
.charge-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid #ccc;
}

.charge-tab {
    padding: 0.5rem 1rem;
    background: #e8e8e8;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: #333;
}

.charge-tab:hover {
    background: #d8d8d8;
}

.charge-tab.active {
    background: white;
    border-bottom: 2px solid white;
    margin-bottom: -2px;
    color: #1a5276;
}

.charge-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding-top: 1rem;
}

/* ===== Redesigned Billing Charge Section ===== */
.charge-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-top: 1rem;
}

.charge-add-section {
    width: 100%;
}

.charge-add-card {
    background: #f0f7ff;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.charge-add-form .charge-add-fields {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.charge-add-fields .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 120px;
}

.charge-add-fields .field-group label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #444;
}

.charge-add-fields .field-group input {
    padding: 0.45rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

.charge-tables-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
}

.charge-table-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.table-card-header .section-title {
    margin: 0;
    font-size: 0.9rem;
    color: #1a5276;
}

.table-card-header .helper-text {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
}

.section-title {
    font-size: 0.95rem;
    color: #1a5276;
    margin-bottom: 0.6rem;
    font-weight: 700;
}

.styled-table-container {
    max-height: 250px;
    overflow-y: auto;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.styled-table thead th {
    background: #2980b9;
    color: white;
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.styled-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.styled-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.styled-table tbody tr:hover {
    background: #e8f4fd;
}

.styled-table-selectable tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.styled-table-selectable tbody tr:hover {
    background: #d4edff;
    box-shadow: inset 3px 0 0 #2980b9;
}

.styled-table .empty-msg {
    text-align: center;
    color: #999;
    padding: 1.5rem !important;
    font-style: italic;
}

.styled-table tbody tr.selected-row {
    background: #fff3cd !important;
    box-shadow: inset 3px 0 0 #f39c12;
}

.charge-form-buttons {
    display: flex;
    gap: 0.4rem;
    align-self: flex-end;
    flex: none !important;
    min-width: auto !important;
}

.charge-item-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.charge-item-form h4 {
    margin-bottom: 0.5rem;
}

.charge-item-form .form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.charge-item-form .form-row label {
    min-width: 100px;
    font-weight: 600;
    font-size: 0.85rem;
}

.charge-item-form .form-row input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
}

.charge-item-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.total-amount-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 2px solid #2980b9;
    margin-top: 1rem;
    background: #f0f7ff;
    border-radius: 0 0 6px 6px;
}

.total-amount-row strong {
    font-size: 1.1rem;
}

/* ===== History Tab ===== */
.history-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.history-search label {
    font-weight: 700;
    font-size: 0.95rem;
}

.history-search input {
    flex: 1;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.history-table-container {
    border: 1px solid #ccc;
    border-radius: 4px;
    min-height: 300px;
    overflow-y: auto;
}

.history-table-container table {
    width: 100%;
    border-collapse: collapse;
}

.history-table-container th,
.history-table-container td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    cursor: pointer;
}

.history-table-container th {
    background: #f0f0f0;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.history-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
}

/* ===== Admin Control Panel ===== */
.admin-panel {
    min-height: 100vh;
    background: linear-gradient(180deg, #e74c3c 0%, #8e44ad 100%);
}

.admin-panel .panel-header h1 {
    color: #8b0000;
}

.admin-content {
    background: #dfe6f0;
    margin: 0 1rem 1rem;
    padding: 1.5rem;
    border-radius: 8px;
    min-height: 70vh;
}

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
}

.admin-tab {
    padding: 0.6rem 1.5rem;
    background: #e0e0e0;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
}

.admin-tab.active {
    background: white;
    color: #1a5276;
}

.admin-table-area {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.admin-table-area table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table-area th,
.admin-table-area td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.admin-table-area th {
    background: #f0f0f0;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.admin-form-area {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-width: 550px;
    margin: 0 auto;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafe, #f0f4fa);
    border: 1px solid #d8e4f0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.admin-form-area .form-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-form-area .form-row label {
    min-width: 100px;
    font-weight: 600;
    text-align: right;
    font-size: 0.85rem;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.admin-form-area .form-row input,
.admin-form-area .form-row textarea,
.admin-form-area .form-row select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    font-size: 0.88rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-form-area .form-row input:focus,
.admin-form-area .form-row textarea:focus,
.admin-form-area .form-row select:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
    outline: none;
}

.admin-form-area .form-row textarea {
    height: 60px;
    resize: vertical;
}

.admin-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary { background: #2980b9; color: white; }
.btn-primary:hover { background: #1a5276; }

.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #1e8449; }

.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-info { background: #8e44ad; color: white; }
.btn-info:hover { background: #6c3483; }

.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }

.btn-reset { background: #7f8c8d; color: white; }
.btn-reset:hover { background: #5d6d7e; }

.btn-logout { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.5); }
.btn-logout:hover { background: rgba(255,255,255,0.3); }

.btn-link { background: none; color: #2980b9; padding: 0.25rem 0.5rem; }
.btn-link:hover { text-decoration: underline; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; padding: 0.75rem; }

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}

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

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

/* ===== Navbar ===== */
.navbar {
    background: linear-gradient(135deg, #1a5276, #2980b9);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand .brand-link {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    margin: 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user .username {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

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

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #2980b9;
}

.stat-card h3 {
    font-size: 2.5rem;
    color: #2980b9;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table thead { background: #f8f9fa; }

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover { background: #f8f9fa; cursor: pointer; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

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

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.field-error {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* ===== Search Form ===== */
.search-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-form input,
.search-form select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-form input { flex: 1; }

/* ===== Inline Form ===== */
.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.inline-form input,
.inline-form select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ===== Detail Grid ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item { padding: 0.5rem 0; }
.detail-item.full-width { grid-column: 1 / -1; }

/* ===== Actions Grid ===== */
.actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e8f4fd;
    color: #2980b9;
}

/* ===== Bill Summary ===== */
.bill-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: right;
}

.bill-summary p { margin: 0.3rem 0; }

.bill-total {
    font-size: 1.2rem;
    color: #27ae60;
    margin-top: 0.5rem !important;
}

/* ===== Auth Pages ===== */
.auth-body {
    background: linear-gradient(135deg, #1a5276, #2980b9);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: 1rem;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header h1 { color: #2980b9; margin-bottom: 0.5rem; }
.auth-header p { color: #666; }
.auth-form { margin-top: 1.5rem; }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.demo-credentials {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
}

.demo-credentials h4 { margin-bottom: 0.5rem; color: #666; }
.demo-credentials p { margin: 0.2rem 0; }

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-size: 0.85rem;
    border-top: 1px solid #eee;
    margin-top: 2rem;
}

/* ===== Time Picker Styling ===== */
.time-picker-group {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: white;
    border: 1px solid #d0d8e0;
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.time-picker-group:focus-within {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.time-select {
    border: none;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.3rem 0.2rem;
    cursor: pointer;
    color: #2c3e50;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    min-width: 42px;
}

.time-select:focus {
    outline: none;
    background: #e8f4fd;
    border-radius: 4px;
}

.time-ampm {
    background: #eef3f8;
    border-radius: 4px;
    padding: 0.3rem 0.4rem;
    font-weight: 700;
    color: #2980b9;
    min-width: 45px;
}

.time-min-input {
    width: 44px !important;
    min-width: 44px !important;
    text-align: center;
    -moz-appearance: textfield;
}

.time-min-input::-webkit-outer-spin-button,
.time-min-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-colon {
    font-weight: 700;
    font-size: 1rem;
    color: #666;
}

.time-input {
    width: 130px !important;
    flex: none !important;
    text-transform: uppercase;
}

/* ===== Modern Form Element Globals ===== */
input[type="date"] {
    position: relative;
}

input:invalid {
    border-color: #e74c3c !important;
}

input:valid:not(:placeholder-shown) {
    border-color: #27ae60;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 0.75rem; }
    .nav-links a { margin: 0 0.25rem; font-size: 0.85rem; }
    .form-row { flex-direction: column; gap: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .register-layout { grid-template-columns: 1fr; }
    .billing-patient-info { grid-template-columns: 1fr; }
    .charge-content { grid-template-columns: 1fr; }
    .charge-tables-grid { grid-template-columns: 1fr; }
    .charge-add-fields { flex-direction: column; }
    .login-buttons { flex-direction: column; }
    .dept-container { flex-direction: column; }
    .page-header { flex-direction: column; gap: 1rem; }
    .inline-form { flex-direction: column; }
    .inline-form input, .inline-form select { width: 100%; }
}
