/* Unified Dashboard CSS for HIPAA-Compliant Korean Medicine PMS */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', Arial, sans-serif;
    background: #ecf0f1;
    margin: 0;
    padding: 0;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
    color: #3498db;
    margin-bottom: 30px;
    font-size: 18px;
    border-bottom: 2px solid #34495e;
    padding-bottom: 10px;
}

.sidebar a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: 5px;
    transition: all 0.3s;
    border-bottom: 1px solid #34495e;
}

.sidebar a:hover {
    background: #34495e;
    padding-left: 20px;
}

.sidebar a.active,
.sidebar a[style*="background-color: #34495e"] {
    background: #008080;
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    padding: 30px;
    width: calc(100% - 250px);
    flex-grow: 1;
}

.main-content h1 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 28px;
}

/* Page Header */
.page-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 24px;
    margin: 0;
}

/* Form Sections */
.form-section,
.form-container {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Input Styling */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

/* Buttons */
.btn,
.btn-submit,
button[type="submit"],
input[type="submit"] {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary,
.btn-submit,
button[type="submit"],
input[type="submit"] {
    background: #008080;
    color: white;
}

.btn-primary:hover,
.btn-submit:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    background: #006666;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 128, 128, 0.2);
}

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

.btn-secondary:hover {
    background: #7f8c8d;
}

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

thead {
    background: #2c3e50;
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

tbody tr:hover {
    background: #f8f9fa;
}

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

/* Messages / Alerts */
.message,
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success,
.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.error,
.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* Search Forms */
.search-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-form h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.search-form form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form input[type="text"] {
    flex: 1;
    min-width: 250px;
}

/* Action Links */
.action-links {
    display: inline-block;
    padding: 8px 16px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.action-links:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Patient List Header */
.patient-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* List Sections */
.list-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.list-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

/* Filter Sections */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #2c3e50;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Calendar Styles (FullCalendar integration) */
#calendar {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.fc-event-title {
    white-space: normal;
}

/* Status Badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-submitted {
    background: #cce5ff;
    color: #004085;
}

.status-paid {
    background: #d4edda;
    color: #155724;
}

.status-denied {
    background: #f8d7da;
    color: #721c24;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #e2e3e5;
    color: #383d41;
}

/* Clinic Form */
.clinic-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.clinic-form h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Required Field Indicator */
.required {
    color: #e74c3c;
    font-weight: bold;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state h3 {
    color: #95a5a6;
    margin-bottom: 10px;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 128, 128, .3);
    border-radius: 50%;
    border-top-color: #008080;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

/* Hamburger Menu Button (Hidden on Desktop) */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #008080;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 128, 128, 0.3);
    transition: all 0.3s;
}

.hamburger-menu:hover {
    background: #006666;
    transform: scale(1.05);
}

.hamburger-menu:active {
    transform: scale(0.95);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.table-responsive table {
    min-width: 600px;
}

/* Mobile Breakpoints */

/* Large Tablets and Small Desktops (1024px and below) */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }

    .form-row {
        gap: 15px;
    }

    .summary-section {
        gap: 15px;
    }
}

/* Tablets (768px and below) */
@media (max-width: 768px) {

    /* Show Hamburger Menu */
    .hamburger-menu {
        display: block;
    }

    /* Sidebar Adjustments */
    .sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        width: 250px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        left: 0;
    }

    /* Main Content */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 70px 15px 15px 15px;
        /* Extra top padding for hamburger */
    }

    /* Dashboard Container */
    .dashboard-container {
        flex-direction: column;
    }

    /* Page Header */
    .page-header {
        padding: 15px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* Form Rows - Stack on Tablet */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Search Forms */
    .search-form form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form input[type="text"] {
        width: 100%;
        min-width: 100%;
    }

    /* Filter Section */
    .filter-section {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    /* Patient List Header */
    .patient-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Summary Section */
    .summary-section {
        flex-direction: column;
        gap: 10px;
    }

    .summary-item {
        width: 100%;
        border-bottom: 1px solid #ecf0f1;
        padding: 15px 0;
    }

    .summary-item:last-child {
        border-bottom: none;
    }

    /* Tables - Enable Horizontal Scroll */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    thead,
    tbody,
    tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    /* Action Links */
    .action-links {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Mobile Phones (480px and below) */
@media (max-width: 480px) {

    /* Typography */
    body {
        font-size: 14px;
    }

    .main-content h1 {
        font-size: 22px;
    }

    .page-header h1 {
        font-size: 18px;
    }

    .form-section h3,
    .list-section h3 {
        font-size: 16px;
    }

    /* Spacing */
    .main-content {
        padding: 65px 10px 10px 10px;
    }

    .form-section,
    .form-container,
    .list-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .page-header {
        padding: 12px;
        margin-bottom: 15px;
    }

    /* Buttons - Touch Friendly */
    .btn,
    .btn-submit,
    button[type="submit"],
    input[type="submit"] {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px;
        /* iOS minimum touch target */
        width: 100%;
        margin-bottom: 10px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    /* Forms */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px;
        /* Prevent iOS zoom on focus */
        padding: 12px;
        min-height: 44px;
    }

    /* Table Cells */
    th,
    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Status Badges */
    .status-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Language Switcher */
    .lang-switcher a {
        display: block;
        margin: 5px 0;
        text-align: center;
        padding: 8px;
    }

    /* Search Form */
    .search-form {
        padding: 15px;
    }

    .search-form h2 {
        font-size: 16px;
    }

    /* Sidebar */
    .sidebar h2 {
        font-size: 16px;
    }

    .sidebar a {
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Summary Values */
    .summary-value {
        font-size: 20px;
    }

    .summary-label {
        font-size: 12px;
    }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 320px) {

    /* Further reduce spacing */
    .main-content {
        padding: 60px 8px 8px 8px;
    }

    .form-section,
    .form-container {
        padding: 12px;
    }

    /* Hamburger Menu */
    .hamburger-menu {
        padding: 10px 12px;
        font-size: 20px;
    }

    /* Typography */
    .main-content h1 {
        font-size: 20px;
    }

    .page-header h1 {
        font-size: 16px;
    }

    /* Compact table cells */
    th,
    td {
        padding: 8px 5px;
        font-size: 12px;
    }

    /* Buttons */
    .btn,
    .btn-submit,
    button[type="submit"],
    input[type="submit"] {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* Landscape Mode Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
        left: -240px;
    }

    .main-content {
        padding-top: 60px;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .hamburger-menu,
    .sidebar-overlay,
    .btn,
    .action-links,
    .lang-switcher {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 0;
    }

    .page-header,
    .form-section,
    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Language Switch */
.lang-switch {
    margin: 10px 0;
    text-align: center;
}

.lang-switch a {
    color: #3498db;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 3px;
}

.lang-switch a:hover {
    background: rgba(52, 152, 219, 0.1);
}

/* Summary Section (for billing and statistics) */
.summary-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 20px;
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
    min-width: 200px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.summary-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #e0e0e0;
}

.summary-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.summary-label {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    margin: 10px 0;
    line-height: 1;
}

.summary-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 16px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.3s;
}

.summary-link:hover {
    background: #2980b9;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 14px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-20 {
    padding: 20px;
}

/* ============================================
   FOOTER STYLES
   ============================================ */

.site-footer {
    background: #ffffff;
    color: #ecf0f1;
    padding: 20px 30px;
    /* margin-top: 40px;
    margin-left: 250px; */
    /* Account for sidebar width */
    border-top: 3px solid #ffffff;
    display: flex;
    justify-content: flex-end;
    /* Right align */
    align-items: center;
    gap: 15px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
    /* Right align content */
}

.footer-text {
    font-size: 14px;
    color: #000000;
    font-weight: 400;
    line-height: 20px;
}

.footer-logo {
    height: 35px;
    width: auto;
    vertical-align: middle;
    transition: transform 0.3s ease;
}

.footer-logo:hover {
    transform: scale(1.05);
}

/* Footer Responsive Design */
@media (max-width: 768px) {
    .site-footer {
        padding: 15px 20px;
        margin-top: 30px;
        margin-left: 0;
        /* Remove sidebar margin on mobile */
        justify-content: center;
        /* Center on mobile */
    }

    .footer-content {
        /* flex-direction: column; */
        gap: 10px;
        text-align: center;
        justify-content: center;
        /* Center on mobile */
    }

    .footer-text {
        font-size: 13px;
    }

    /* .footer-logo {
        height: 18px;
    } */
}

@media (max-width: 480px) {
    .site-footer {
        padding: 12px 15px;
        margin-top: 20px;
    }

    .footer-text {
        font-size: 12px;
    }

    .footer-logo {
        height: 20px;
    }
}