/* ============================================================
   DATAZAD CLINIC PRO - Style Principal
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #10b981;
    
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-xl: 0 10px 15px rgba(0,0,0,0.1);
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 8px;
    --radius-lg: 12px;
    
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Dark mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.3);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: var(--primary); }
ul { list-style: none; }
img { max-width: 100%; }

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container { width: 100%; max-width: 420px; }

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-logo i { font-size: 36px; color: white; }

.login-header h1 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.login-form label i { margin-right: 8px; }

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.3s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 12px;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-white);
    font-size: 18px;
    font-weight: 700;
}

.sidebar-logo i { font-size: 24px; color: var(--primary-light); }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i { font-size: 20px; color: white; }

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--text-white);
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    color: var(--text-light);
    font-size: 12px;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-light);
    font-size: 14px;
    transition: all 0.3s;
}

.sidebar-nav ul li a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.sidebar-nav ul li a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-nav ul li.active a {
    background: var(--primary);
    color: var(--text-white);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    background: var(--bg-header);
    padding: 0 30px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
}

.header-left h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right { display: flex; align-items: center; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle, .btn-logout, .dropdown-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    position: relative;
}

.theme-toggle:hover, .btn-logout:hover, .dropdown-toggle:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Content */
.content {
    padding: 25px 30px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover { transform: translateY(-5px); }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.blue .stat-icon { background: rgba(37,99,235,0.1); color: var(--primary); }
.stat-card.green .stat-icon { background: rgba(16,185,129,0.1); color: var(--secondary); }
.stat-card.yellow .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card.red .stat-icon { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-card.purple .stat-icon { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-card.info .stat-icon { background: rgba(59,130,246,0.1); color: var(--info); }

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 5px;
}

/* Tables */
.table-container { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.table tbody tr:hover { background: var(--bg-primary); }

.table-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-dark); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: white; }

.btn-info { background: var(--info); color: white; }

.btn-light {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-light:hover { background: var(--border); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* Forms */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

select.form-control { cursor: pointer; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-inline {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

.alert-dismissible {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
}

.btn-close:hover { opacity: 1; }

/* Status badges */
.status-badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-confirmed, .status-paid { background: rgba(16,185,129,0.1); color: var(--success); }
.status-completed { background: rgba(59,130,246,0.1); color: var(--info); }
.status-cancelled, .status-unpaid { background: rgba(239,68,68,0.1); color: var(--danger); }
.status-partial { background: rgba(245,158,11,0.1); color: var(--warning); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-lg { max-width: 900px; }

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body { padding: 20px; }

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* Patient view */
.patient-header {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.patient-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.patient-info-item label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.patient-info-item p {
    font-size: 15px;
    font-weight: 500;
    margin-top: 5px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Search box */
.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input {
    flex: 1;
    min-width: 200px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

/* Filters bar */
.filters-bar {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

/* Dropdown */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    z-index: 100;
    border: 1px solid var(--border);
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
}

.dropdown-menu a:hover { background: var(--bg-primary); }

/* Print */
@media print {
    .sidebar, .top-header, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .content { padding: 0; }
}

/* Responsive */
@media (max-width: 1200px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .stat-cards { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 15px; align-items: stretch; }
    .form-inline { flex-direction: column; }
    .form-inline .form-group { min-width: 100%; }
    .content { padding: 15px; }
    .top-header { padding: 0 15px; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px 10px; }
}

/* RTL Support */
.rtl-mode .sidebar { left: auto; right: 0; }
.rtl-mode .sidebar.open { transform: translateX(0); }
.rtl-mode .main-content { margin-left: 0; margin-right: var(--sidebar-width); }
.rtl-mode .table th { text-align: right; }
.rtl-mode .header-left h2 { order: 1; }

@media (max-width: 992px) {
    .rtl-mode .main-content { margin-right: 0; }
}

/* Page loader */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loader::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Calendar customization */
.fc { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; }
.fc .fc-toolbar-title { font-size: 18px !important; color: var(--text-primary); }
.fc .fc-button-primary { background: var(--primary) !important; border-color: var(--primary) !important; }
.fc .fc-daygrid-day-number { color: var(--text-primary); }
.fc .fc-col-header-cell-cushion { color: var(--text-secondary); }

/* Charts */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

/* Misc */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
