/**
 * Advanced Pharmacy Management System
 * Main Stylesheet
 */

@import url('sidebar.css');

/* ========== Reset & Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #ea580c;
    --info-color: #0891b2;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #334155;
    --text-light: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #1d4ed8;
}

/* ========== Login Page ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 12px;
}

/* ========== Top Header ========== */
.top-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.header-brand:hover {
    background: #f3f4f6;
}

.brand-icon {
    font-size: 28px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: #4b5563;
    font-weight: 500;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #2563eb;
}

.nav-link.active {
    background: #eff6ff;
    color: #2563eb;
}

.nav-link .icon {
    font-size: 18px;
}

.nav-link .arrow {
    font-size: 8px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown:hover .nav-link .arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 200px;
    padding: 6px;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #4b5563;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.dropdown-content a:hover {
    background: #f3f4f6;
    color: #2563eb;
}

.dropdown-content a .icon {
    font-size: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.user-avatar {
    font-size: 24px;
}

.user-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #6b7280;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 4px;
}

.arrow-down {
    font-size: 8px;
    color: #9ca3af;
    transition: transform 0.2s;
}

.user-dropdown:hover .arrow-down {
    transform: rotate(180deg);
}

.user-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 250px;
    padding: 12px;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.user-dropdown:hover .user-dropdown-content {
    display: block;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.user-avatar-large {
    font-size: 40px;
}

.user-name-large {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
}

.user-role-small {
    font-size: 12px;
    color: #6b7280;
}

.user-dropdown-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #dc2626;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.logout-link:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.logout-link .icon {
    font-size: 16px;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.mobile-menu-btn span {
    width: 24px;
    height: 3px;
    background: #4b5563;
    border-radius: 2px;
    transition: all 0.3s;
}

.mobile-menu-btn:hover span {
    background: #2563eb;
}

/* ========== Footer ========== */
.main-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    margin-top: 50px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    color: var(--text-light);
    font-size: 13px;
}

/* ========== Container ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ========== Page Header ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 28px;
    color: var(--dark-color);
}

.page-header p {
    color: var(--text-light);
    margin-top: 5px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #15803d;
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #0e7490;
    color: white;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-logout {
    background: var(--danger-color);
    color: white;
}

.btn-logout:hover {
    background: #b91c1c;
    color: white;
}

/* ========== Alerts ========== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #dcfce7;
    border-color: var(--success-color);
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background: #fed7aa;
    border-color: var(--warning-color);
    color: #9a3412;
}

.alert-info {
    background: #cffafe;
    border-color: var(--info-color);
    color: #155e75;
}

/* ========== Forms ========== */
.form {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.form-container {
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 12px;
}

.required {
    color: var(--danger-color);
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--dark-color);
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--light-color);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--light-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .actions {
    display: flex;
    gap: 8px;
}

.table .no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.row-warning {
    background: #fef3c7;
}

.row-danger {
    background: #fee2e2;
}

.total-row {
    background: var(--light-color);
    font-weight: 600;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid;
}

.stat-card.stat-primary {
    border-color: var(--primary-color);
}

.stat-card.stat-success {
    border-color: var(--success-color);
}

.stat-card.stat-info {
    border-color: var(--info-color);
}

.stat-card.stat-warning {
    border-color: var(--warning-color);
}

.stat-icon {
    font-size: 36px;
}

.stat-info h3 {
    font-size: 24px;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.stat-info p {
    color: var(--text-light);
    font-size: 13px;
}

.stat-info small {
    font-size: 12px;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-pharmacist {
    background: #e0e7ff;
    color: #4338ca;
}

.badge-staff {
    background: #fef3c7;
    color: #92400e;
}

.badge-low {
    background: var(--warning-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-incoming,
.badge-adjustment {
    background: #dcfce7;
    color: #166534;
}

.badge-outgoing,
.badge-sale {
    background: #fee2e2;
    color: #991b1b;
}

/* ========== Filters ========== */
.filter-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group,
.search-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-group label {
    font-weight: 500;
    margin-right: 5px;
    white-space: nowrap;
}

.filter-group select,
.filter-group input,
.search-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.date-range {
    color: var(--text-light);
    font-size: 13px;
    padding: 8px 12px;
}

/* ========== Alerts Section ========== */
.alerts-section {
    margin-bottom: 30px;
}

.alerts-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--dark-color);
}

/* ========== Dashboard Section ========== */
.dashboard-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    color: var(--dark-color);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* ========== Quick Actions ========== */
.quick-actions {
    margin-top: 30px;
}

.quick-actions h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.action-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    color: inherit;
}

.action-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.action-card h3 {
    font-size: 16px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.action-card p {
    font-size: 13px;
    color: var(--text-light);
}

/* ========== Sales Form ========== */
.sale-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 6px;
}

.sale-summary {
    background: var(--light-color);
    padding: 25px;
    border-radius: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
    border-bottom: none;
}

.total-row {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--primary-color);
}

/* ========== Receipt ========== */
.receipt-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.receipt-header {
    text-align: center;
    margin-bottom: 30px;
}

.receipt-header h1 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.receipt-header p {
    color: var(--text-light);
    font-size: 14px;
}

.receipt-divider {
    height: 2px;
    background: var(--border-color);
    margin: 20px 0;
}

.receipt-info {
    margin-bottom: 20px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.receipt-table {
    width: 100%;
    margin: 20px 0;
}

.receipt-table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

.receipt-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.receipt-totals {
    margin-top: 20px;
}

.receipt-grand-total {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    padding-top: 10px;
    margin-top: 10px;
}

.receipt-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-light);
}

/* ========== Settings ========== */
.settings-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    font-size: 18px;
    color: var(--dark-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.settings-form {
    padding: 0;
    box-shadow: none;
}

/* ========== Report Sections ========== */
.report-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.report-section h2 {
    font-size: 20px;
    color: var(--dark-color);
    margin-bottom: 20px;
}

.report-actions {
    margin-top: 20px;
    text-align: center;
}

/* ========== Text Utilities ========== */
.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-info {
    color: var(--info-color);
}

/* ========== Print Styles ========== */
@media print {
    .no-print {
        display: none !important;
    }
    
    .receipt-container {
        box-shadow: none;
        padding: 20px;
    }
    
    body {
        background: white;
    }
}

/* ========== Responsive ========== */
@media (max-width: 968px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .header-left {
        gap: 15px;
    }
    
    .main-nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 16px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        align-items: stretch;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .nav-link {
        justify-content: space-between;
        padding: 12px 16px;
    }
    
    .dropdown-content {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        border-left: 3px solid #2563eb;
        margin-left: 20px;
        margin-top: 8px;
    }
    
    .nav-dropdown.active .dropdown-content {
        display: block;
    }
    
    .user-role {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 15px;
    }
    
    .brand-text {
        font-size: 16px;
    }
    
    .brand-icon {
        font-size: 24px;
    }
    
    .user-name {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .sale-item-row {
        grid-template-columns: 1fr;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
    
    .header-user {
        gap: 8px;
    }
    
    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
    }
}

