/* ==========================================================================
   PharmPro — Professional Dashboard Stylesheet
   Clean, sharp-edged, corporate software look. Fully responsive.
   ========================================================================== */

/* --- Google Fonts & Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;      /* Professional Royal Blue */
    --primary-dark: #1e40af;
    --primary-light: #eff6ff;
    --secondary-color: #1e293b;    /* Slate Dark for Text */
    --bg-color: #ffffff;           /* White Professional Background */
    --hover-bg: #f1f5f9;           /* Subtle hover shade (used for hover states only) */
    --white: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);
    --radius: 4px;      /* sharp, minimal corners across the app */
    --radius-sm: 2px;
}

/* --- Global Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--bg-color);
    color: var(--secondary-color);
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
}

img { max-width: 100%; display: block; }

/* ==========================================================================
   Header
   ========================================================================== */
.main-header {
    height: var(--header-height);
    background: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-menu {
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--secondary-color);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.hamburger-menu:hover { background: var(--hover-bg); }

.header-logo {
    height: 34px;
    width: auto;
    display: block;
    object-fit: contain;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo-icon {
    font-size: 1.6rem;
    color: var(--primary-color);
}

.brand-name {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    color: var(--secondary-color);
}

.brand-name small {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
}

/* --- User Profile & Logout --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.9rem;
}

#userEmail {
    font-size: 1.05rem;
    font-weight: 600;
}

.profile-icon {
    font-size: 1.8rem;
    color: #cbd5e1;
}

.logout-pill {
    background: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-pill:hover {
    background: var(--primary-color);
    color: white;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    height: calc(100vh - var(--header-height));
    position: fixed;
    top: var(--header-height);
    left: 0;
    padding: 16px 0;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: left 0.25s ease;
    z-index: 998;
}

.menu-label {
    padding: 16px 24px 8px;
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 11px 24px;
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
    border-left: 3px solid transparent;
}

.nav-item i {
    margin-right: 14px;
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.nav-item.active {
    border-left-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.content-body {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 28px;
    transition: margin-left 0.25s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
}

.welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.welcome-bar h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.current-date {
    color: #64748b;
    font-size: 0.88rem;
    margin-top: 2px;
}

.currency-tag {
    background: var(--secondary-color);
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 22px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    min-width: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.sales  { background: #dcfce7; color: var(--success); }
.stat-icon.orders { background: #dbeafe; color: #3b82f6; }
.stat-icon.stock  { background: #fee2e2; color: var(--danger); }

.stat-info { min-width: 0; }
.stat-info h3 {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}
.stat-info p {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Analytics Row & Quick Actions
   ========================================================================== */
.analytics-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.chart-container, .action-form-card {
    background: var(--white);
    padding: 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    min-width: 0;
}

.card-header {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-canvas-wrap {
    height: 280px;
    position: relative;
}

@media (max-width: 480px) {
    .chart-canvas-wrap { height: 220px; }
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.action-form-card h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* Quick Actions Buttons */
.quick-links-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary.btn-neutral { background: #475569; color: white; }
.btn-primary.btn-accent  { background: var(--primary-color); color: white; }
.btn-primary.btn-confirm { background: var(--success); color: white; }

.quick-actions-note {
    font-size: 0.72rem;
    margin-top: 14px;
    color: #94a3b8;
    line-height: 1.5;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
    margin-top: auto;
    padding: 28px 0 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    border-top: 1px solid var(--border-color);
}

.footer-links {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 10px;
    font-weight: 500;
}

.footer-links a:hover { text-decoration: underline; }

/* --- Overlay for Mobile Sidebar --- */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 997;
}

.overlay.show { display: block; }

/* ==========================================================================
   Header Brand (Logo + Name)
   ========================================================================== */
.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 2px;
}

/* ==========================================================================
   Pharmacy Identity — simple centered
   ========================================================================== */
.pharmacy-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 24px;
    margin-bottom: 24px;
}

.identity-logo {
    width: 260px;
    height: 260px;
    object-fit: contain;
    border-radius: 50%;
    margin-bottom: 4px;
}

.identity-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
    letter-spacing: -0.3px;
    text-align: center;
    margin-bottom: 4px;
}

.identity-date {
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
}

/* ==========================================================================
   Premium Hero Section (used on some pages)
   ========================================================================== */
.hero-premium {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 36px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    color: white;
    box-shadow: var(--shadow-md);
}

.hero-premium::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(37, 99, 235, 0.12);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 28px;
    z-index: 1;
}

.hero-logo-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-glow 3s infinite;
}

.hero-logo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
    padding: 10px;
    border-radius: var(--radius);
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-md);
}

.welcome-badge {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    padding: 5px 14px;
    border-radius: var(--radius);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-info h2 {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 8px 0;
    letter-spacing: -0.5px;
}

.hero-info p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.hero-stats-mini {
    display: flex;
    gap: 16px;
    z-index: 1;
    flex-wrap: wrap;
}

.mini-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 14px 22px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

.mini-stat .label {
    display: block;
    color: #94a3b8;
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.mini-stat .value {
    color: #f8fafc;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-stat .value i { color: var(--success); }

@keyframes pulse-glow {
    0%   { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    50%  { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 1024px) {
    .analytics-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        left: -280px;
        width: 280px;
    }

    .sidebar.active { left: 0; }

    .content-body {
        margin-left: 0;
        padding: 18px 14px;
        width: 100%;
    }

    .header-container { padding: 0 14px; }

    .hide-mobile { display: none; }

    .brand-name { font-size: 1.05rem; }

    .welcome-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .hero-premium { flex-direction: column; text-align: center; gap: 24px; padding: 24px; }
    .hero-content { flex-direction: column; }
    .hero-stats-mini { justify-content: center; width: 100%; }
    .mini-stat { text-align: center; flex: 1; }

    .identity-logo { width: 190px; height: 190px; margin-bottom: 4px; }
    .identity-name { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 18px; }

}