/* =====================================================
   COMPONENTS.CSS
   Reusable Cards, Buttons, Form Containers,
   Page Headers, Alerts, Badges, Utility Classes
   ===================================================== */

/* =====================================================
   LINKS & BUTTONS (Bootstrap overrides)
   ===================================================== */

a {
    color: var(--teal);
}

.btn-primary {
    color: #fff;
    background-color: var(--navy);
    border-color: var(--navy-mid);
}

.btn-primary:hover {
    background-color: var(--navy-mid);
    border-color: var(--navy);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background-color: var(--navy);
    border-color: var(--navy-mid);
}

/* =====================================================
   CARDS
   ===================================================== */

.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.15s, transform 0.15s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    border-top: 1px solid #e5e7eb;
    padding: 16px 20px;
    background-color: #f9fafb;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
    font-size: 0.95rem;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-success {
    background-color: #059669;
    border-color: #059669;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #047857;
    border-color: #047857;
    color: #ffffff;
}

.btn-danger {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

.btn-outline-primary {
    color: #2563eb;
    border-color: #2563eb;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: #2563eb;
    color: #ffffff;
}

.btn-outline-success {
    color: #059669;
    border-color: #059669;
    background-color: transparent;
}

.btn-outline-success:hover {
    background-color: #059669;
    color: #ffffff;
}

.btn-outline-danger {
    color: #dc2626;
    border-color: #dc2626;
    background-color: transparent;
}

.btn-outline-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =====================================================
   FORM CONTROLS
   ===================================================== */

.form-control,
.form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #1f2937;
}

/* =====================================================
   PAGE HEADER / HERO
   ===================================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =====================================================
   ALERTS
   ===================================================== */

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background-color: #f0f9ff;
    border-color: #bae6fd;
    color: #0c4a6e;
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

/* =====================================================
   BADGES
   ===================================================== */

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-primary {
    background-color: #dbeafe;
    color: #0c4a6e;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* =====================================================
   VALIDATION MESSAGES
   ===================================================== */

.text-danger {
    color: #dc2626;
}

.invalid-feedback {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #dc2626;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc2626;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.border-top {
    border-top: 1px solid #e5e7eb;
}

.border-bottom {
    border-bottom: 1px solid #e5e7eb;
}

.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

.rounded-lg {
    border-radius: 8px;
}

.rounded-xl {
    border-radius: 12px;
}

.shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

/* =====================================================
   OPD SCREEN COMPONENTS
   ===================================================== */

.section-panel {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(250, 250, 255, 0.75));
    border: 1px solid rgba(13, 110, 253, 0.06);
    border-radius: .75rem;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(11, 32, 79, 0.04);
    backdrop-filter: blur(6px);
}

.section-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
}

.icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 6px 18px rgba(11, 32, 79, 0.06);
    flex-shrink: 0;
}

.icon-patient {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.icon-visit {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.icon-billing {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.section-title {
    font-weight: 600;
    margin: 0;
}

.section-sub {
    color: #6c757d;
    font-size: .9rem;
    margin: 0;
}

/* =====================================================
   BOOTSTRAP HELPERS (overrides)
   ===================================================== */

a.navbar-brand {
    white-space: normal;
    text-align: center;
    word-break: break-all;
}

button.accept-policy {
    font-size: 1rem;
    line-height: inherit;
}

/* =====================================================
   FOOTER STYLING
   ===================================================== */

footer.footer {
    text-align: center;
    padding: 13px;
    font-size: .8rem;
    color: var(--text-muted);
    background: var(--white);
    border-top: 1px solid #e8ecf0;
    width: 100%;
    flex-shrink: 0;
}

footer.footer a {
    color: var(--teal);
    text-decoration: none;
}

footer.footer a:hover {
    text-decoration: underline;
}

/* =====================================================
   RESPONSIVE UTILITIES
   ===================================================== */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

    .alert {
        flex-direction: column;
    }

    .alert-icon {
        margin-top: 0;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =====================================================
   FORM GRID
   ===================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* =====================================================
   TABLE UTILITIES
   ===================================================== */

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-responsive.list-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #1f2937;
    padding: 12px 16px;
    font-weight: 600;
    background-color: #f9fafb;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}
