/**
 * Homeopathic Assistant - Main Stylesheet
 * Modern, Clean, Professional Design
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 10px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--gray-100);
}

/* ============================================
   HEADER NAVIGATION
   ============================================ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    box-shadow: var(--box-shadow);
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.logo i {
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-search {
    position: relative;
}

.search-input {
    width: 300px;
    padding: 10px 40px 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: 25px;
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    width: 350px;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 18px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--gray-100);
}

.user-dropdown hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid var(--gray-200);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--white);
    box-shadow: var(--box-shadow);
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar-nav ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 25px;
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, var(--primary-color) 0%, transparent 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.sidebar-nav a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-nav .badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.nav-section {
    padding: 20px 25px 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.version {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
}

.container-fluid {
    width: 100%;
    padding: 0 15px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-header h1 i {
    color: var(--primary-color);
}

.page-header .text-muted {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 5px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   CARDS & PANELS
   ============================================ */
.dashboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--gray-100);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
}

.stat-primary .stat-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.stat-success .stat-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-info .stat-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-warning .stat-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-details h3 {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.stat-details p {
    margin: 0;
    color: var(--gray-600);
    font-size: 14px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

/* ============================================
   TABLES
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-info {
    background: var(--info-color);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--primary-color);
    color: var(--white);
}

.badge-success {
    background: var(--success-color);
    color: var(--white);
}

.badge-danger {
    background: var(--danger-color);
    color: var(--white);
}

.badge-warning {
    background: var(--warning-color);
    color: var(--white);
}

.badge-info {
    background: var(--info-color);
    color: var(--white);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 15px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
    margin-bottom: 30px;
}

.quick-actions h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.action-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    text-decoration: none;
    color: var(--dark-color);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    color: var(--primary-color);
}

.action-card i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.action-card span {
    display: block;
    font-weight: 500;
}

/* ============================================
   FOLLOW-UP LIST
   ============================================ */
.followup-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.followup-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: 8px;
    transition: var(--transition);
}

.followup-item:hover {
    background: var(--gray-100);
}

.followup-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 8px;
}

.followup-date .day {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.followup-date .month {
    font-size: 12px;
    text-transform: uppercase;
}

.followup-details {
    flex: 1;
}

.followup-details strong {
    display: block;
    margin-bottom: 5px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-600);
    font-size: 13px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-dismissible {
    position: relative;
    padding-right: 40px;
}

.alert .close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 60px;
    }
    
    /* Header adjustments */
    .header-content {
        padding: 0 10px;
    }
    
    .logo span {
        display: none; /* Hide text, keep icon */
    }
    
    .header-search {
        display: none;
    }
    
    .header-right {
        gap: 5px;
    }
    
    .user-info span {
        display: none; /* Hide username on very small screens */
    }
    
    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        position: fixed;
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Main content */
    .main-content {
        margin-left: 0;
        padding: 15px 10px;
        margin-top: var(--header-height);
    }
    
    .footer {
        margin-left: 0;
        padding: 15px 10px;
        font-size: 12px;
    }
    
    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .breadcrumb {
        font-size: 12px;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px;
        white-space: nowrap;
    }
    
    /* Forms */
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control,
    .form-select,
    textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Search filters */
    .search-box,
    .filter-section {
        padding: 15px;
    }
    
    /* Patient list */
    .patient-card,
    .consultation-card {
        padding: 15px;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}

/* Small Devices (phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    :root {
        --sidebar-width: 100%;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content,
    .footer {
        margin-left: 0;
    }
    
    .header-search {
        max-width: 200px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar {
        transform: translateX(0);
    }
    
    .main-content,
    .footer {
        margin-left: var(--sidebar-width);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        gap: 15px;
    }
    
    .form-row .form-group {
        flex: 1;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 767.98px) and (orientation: landscape) {
    .main-header {
        height: 50px;
    }
    
    .sidebar {
        width: 250px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .main-header,
    .footer,
    .btn,
    .page-actions,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    .btn,
    .sidebar-nav a,
    .nav-link,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .sidebar-nav a:hover {
        transform: none;
    }
    
    /* Better scrolling on touch devices */
    .table-responsive,
    .modal-body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Utility Classes */
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: 15px; }
.mb-3 { margin-bottom: 15px; }

/* Mobile utility classes */
.mobile-only { display: none; }
.desktop-only { display: block; }

@media (max-width: 767.98px) {
    .mobile-only { display: block; }
    .desktop-only { display: none; }
    .hide-mobile { display: none; }
}
