/* Pharmacy ERP SaaS - Custom Styles */

:root {
    --sidebar-width: 250px;
    --sidebar-color: #1e293b;
    --navbar-color: #ffffff;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    overflow-x: hidden;
}

/* Wrapper */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.5);
}

.sidebar-nav {
    padding-bottom: 50vh;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8) !important;
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 0;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff !important;
    padding-left: 25px;
}

.sidebar-nav .nav-link.active {
    background-color: rgba(255,255,255,0.15);
    color: #fff !important;
    border-left: 3px solid var(--primary-color);
}

.sidebar-nav .nav-link i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

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

/* Navbar */
.navbar {
    min-height: 56px;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #64748b;
}

/* Tables */
.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Forms */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #475569;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Dark mode */
[data-bs-theme="dark"] {
    --bs-body-bg: #0f172a;
    --bs-body-color: #e2e8f0;
}

[data-bs-theme="dark"] .card {
    background-color: #1e293b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .card-header {
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
}

[data-bs-theme="dark"] .table thead th {
    background-color: #1e293b;
    color: #94a3b8;
}

[data-bs-theme="dark"] .navbar {
    background-color: #1e293b !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    color: #e2e8f0;
}

/* Avatar */
.avatar-sm {
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Membership Badge */
.membership-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.membership-active { background: #dcfce7; color: #166534; }
.membership-expired { background: #fee2e2; color: #991b1b; }
.membership-grace { background: #fef9c3; color: #854d0e; }
.membership-locked { background: #f1f5f9; color: #475569; }
.membership-trial { background: #dbeafe; color: #1e40af; }

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.375rem;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-line { height: 0.875rem; margin-bottom: 0.5rem; }
.skeleton-line:last-child { margin-bottom: 0; width: 60%; }
.skeleton-card { height: 120px; }

/* Empty State with CTA */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.empty-state p {
    font-size: 1rem;
    margin-bottom: 1rem;
}
.empty-state .btn { margin-top: 0.25rem; }

/* Loading Button */
.btn-loading { pointer-events: none; opacity: 0.75; }
.btn-loading .spinner-border { width: 1rem; height: 1rem; margin-right: 0.375rem; }

/* Print Styles */
@media print {
    .sidebar, .navbar, .no-print, .btn, .dropdown { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    body { background: #fff !important; color: #000 !important; }
    .table { font-size: 0.8rem; }
    .table thead th { background: #f8f9fa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { text-decoration: none !important; color: #000 !important; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* Dark mode improvements */
[data-bs-theme="dark"] .empty-state { color: #64748b; }
[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #334155 25%, #1e293b 50%, #334155 75%);
    background-size: 200% 100%;
}
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
    background-color: #0f172a; border-color: #334155; color: #e2e8f0;
}
[data-bs-theme="dark"] .stat-card { background-color: #1e293b; }

/* Responsive improvements */
@media (max-width: 576px) {
    .card-header { flex-direction: column; align-items: flex-start !important; gap: 0.5rem; }
    .table { font-size: 0.8rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
}
