/* 
   Mshealthzone Dashboard Stylesheet
   Modern, Dark Mode, Premium Medical-themed Dashboard
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-tertiary: #1e293b;
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #0ea5e9; /* Cyan */
    --accent-teal: #10b981; /* Emerald/Teal */
    --accent-orange: #f59e0b; /* Amber */
    --accent-rose: #f43f5e; /* Rose */
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --border-glow: rgba(99, 102, 241, 0.4);
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.15);
    box-shadow: inset 3px 0 0 var(--accent-primary);
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.nav-item a:hover svg {
    transform: scale(1.1);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-secondary);
    font-weight: 600;
    border: 2px solid var(--border-color);
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    border-color: var(--accent-primary);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0.7;
}

.stat-card.overdue::after {
    background: var(--accent-rose);
}
.stat-card.due-today::after {
    background: var(--accent-orange);
}
.stat-card.completed::after {
    background: var(--accent-teal);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.overdue .stat-icon {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
}
.stat-card.due-today .stat-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}
.stat-card.completed .stat-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-teal);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Layout (Split Panels or Tables) */
.content-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

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

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #334155;
    color: white;
}

.btn-success {
    background-color: var(--accent-teal);
    color: white;
}

.btn-success:hover {
    background-color: #0d9488;
}

.btn-danger {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background-color: var(--accent-rose);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 6px;
}

/* Forms and Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group.row-flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--border-glow);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th {
    padding: 0.85rem 1rem;
    background-color: rgba(30, 41, 59, 0.5);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.3);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-overdue {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-today {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-upcoming {
    background-color: rgba(14, 165, 233, 0.15);
    color: var(--accent-secondary);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.badge-completed {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-teal);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--accent-rose);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Medicine Table Builder inside Modals */
.medicine-builder-table {
    width: 100%;
    margin-top: 0.5rem;
    border-collapse: collapse;
}

.medicine-builder-table th {
    font-size: 0.8rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.medicine-builder-table td {
    padding: 0.4rem;
    border: none;
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--accent-primary);
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
    }
    to {
        transform: translateX(0);
    }
}

.toast-success { border-left-color: var(--accent-teal); }
.toast-error { border-left-color: var(--accent-rose); }
.toast-warning { border-left-color: var(--accent-orange); }

/* Installer Styles */
.installer-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent), var(--bg-primary);
    padding: 2rem;
}

.installer-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.installer-header {
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(30, 41, 59, 0.4));
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.installer-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}

.installer-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.installer-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.installer-steps {
    display: flex;
    justify-content: space-around;
    padding: 1rem 2rem;
    background-color: rgba(30, 41, 59, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.installer-step {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.installer-step.active {
    color: var(--accent-secondary);
}

.installer-step.completed {
    color: var(--accent-teal);
}

.installer-step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.installer-step.active .installer-step-num {
    border-color: var(--accent-secondary);
    background-color: rgba(14, 165, 233, 0.1);
}

.installer-step.completed .installer-step-num {
    border-color: var(--accent-teal);
    background-color: var(--accent-teal);
    color: white;
}

.installer-body {
    padding: 2rem;
}

.installer-footer {
    padding: 1.25rem 2rem;
    background-color: rgba(30, 41, 59, 0.3);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Alert Box */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
    color: #fda4af;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

/* Login Page Styling */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.12), transparent 70%), var(--bg-primary);
    padding: 2rem;
}

.login-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1.5rem;
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* Search bar styling */
.search-bar-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-input-wrapper svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.search-input-wrapper .form-control {
    padding-left: 2.5rem;
}

/* Call Queue Table / List custom */
.customer-name-wrapper {
    display: flex;
    flex-direction: column;
}

.customer-subtext {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.medicine-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 300px;
}

.medicine-micro-badge {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid var(--border-color);
}

/* History Timeline styling */
.history-timeline {
    position: relative;
    padding-left: 1.5rem;
    margin-top: 1rem;
}

.history-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    border: 2px solid var(--bg-secondary);
}

.timeline-item.success::before {
    background-color: var(--accent-teal);
}

.timeline-item.fail::before {
    background-color: var(--accent-rose);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.timeline-body {
    font-size: 0.85rem;
    color: var(--text-primary);
    background-color: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 6px;
}
