:root {
    /* Themes */
    --admin-primary: #1e272e;
    --admin-secondary: #27ae60;
    --admin-accent: #ffa801;
    
    --supplier-primary: #006266;
    --supplier-secondary: #1289A7;
    
    --pharmacist-primary: #05c46b;
    --pharmacist-secondary: #0652DD;

    --white: #ffffff;
    --bg-color: #f8f9fb;
    --text-color: #2d3436;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
    --border-radius: 16px;
    
    /* Default Dynamic Colors */
    --primary-color: #27ae60; 
    --secondary-color: #2c3e50;
    --accent-color: #3498db;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
body.dark-mode {
    --white: #1e272e;
    --bg-color: #121212;
    --text-color: #f1f2f6;
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
    --border-color: #2d3436;
}

body.dark-mode .top-header,
body.dark-mode .stat-card,
body.dark-mode .inventory-table,
body.dark-mode .tabs-nav,
body.dark-mode .form-card,
body.dark-mode .login-card,
body.dark-mode .pos-products,
body.dark-mode .pos-bill {
    background-color: #1e272e !important;
    color: #f1f2f6 !important;
    border-color: #2d3436 !important;
}

body.dark-mode table th { color: #a4b0be; }
body.dark-mode table td { border-bottom-color: #2d3436; color: #f1f2f6; }
body.dark-mode .menu a { color: rgba(255,255,255,0.6); }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
    background-color: #2d3436;
    border-color: #485460;
    color: white;
}

/* Hover Effects */
.stat-card:hover, .pos-item-card:hover, .form-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
}

body.dark-mode .stat-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

/* Skeleton Loading Animation */
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

body.dark-mode .skeleton {
  background: linear-gradient(90deg, #2d3436 25%, #3d4446 50%, #2d3436 75%);
  background-size: 200% 100%;
}

/* Notification Pulse Animation */
@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.pulse-notify {
  animation: pulse-red 2s infinite;
}

/* Blue Pulse for Supplier Inquiries */
@keyframes pulse-blue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(52, 152, 219, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

.pulse-blue {
  animation: pulse-blue 2s infinite;
}

body.admin-theme { --primary-color: var(--admin-primary); --secondary-color: var(--admin-secondary); }
body.supplier-theme { --primary-color: var(--supplier-primary); --secondary-color: var(--supplier-secondary); }
body.pharmacist-theme { --primary-color: var(--pharmacist-primary); --secondary-color: var(--pharmacist-secondary); }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Cairo', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); overflow-x: hidden; }

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

.main-content {
    flex: 1;
    padding: 25px;
    width: calc(100% - 280px);
    animation: pageLoad 0.6s ease-out;
}

@keyframes pageLoad {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(0, 0, 0, 0.1) 100%), var(--primary-color);
    color: white;
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    /* height: 100vh; */
    position: sticky;
    top: 0;
    flex-shrink: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.sidebar-header {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    animation: slideDown 0.6s ease-out;
}

.sidebar-header i {
    animation: rotateIcon 3s linear infinite;
    transition: transform 0.3s ease;
}

.sidebar-header:hover i {
    animation: rotateIcon 1.5s linear infinite;
    transform: scale(1.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotateIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.menu a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-left: 3px solid transparent;
}

.menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(8px);
    padding-right: 20px;
    border-left-color: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.menu a:hover::before {
    transform: translateX(100%);
}

.menu a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

.menu a i {
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.menu a:hover i {
    transform: scale(1.25) rotate(15deg);
}

.menu a.active i {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logout-link {
    color: rgba(255, 119, 117, 0.9) !important;
    margin-top: auto;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.logout-link:hover {
    color: #ff7675 !important;
    background: rgba(231, 76, 60, 0.1) !important;
    border-left-color: rgba(231, 76, 60, 0.5) !important;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    animation: slideDownFade 0.6s ease-out 0.1s both;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.top-header:hover {
    border-bottom-color: var(--primary-color);
    box-shadow: var(--shadow), 0 4px 12px rgba(0, 0, 0, 0.08);
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideRight 0.6s ease-out 0.2s both;
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.user-profile img:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Cards & Content */
.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid #f1f2f6;
    transition: var(--transition);
    animation: cardFadeIn 0.6s ease-out both;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.inventory-table {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 25px;
    overflow-x: auto;
    animation: slideUpFade 0.6s ease-out 0.2s both;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    text-align: right;
}

table tbody tr {
    animation: rowFadeIn 0.4s ease-out;
    transition: all 0.3s ease;
}

table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

th, td {
    padding: 15px;
    border-bottom: 1px solid #f1f2f6;
    transition: all 0.3s ease;
}

th {
    color: #636e72;
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

th::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Buttons & Inputs */
.btn-action {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-action:active::before {
    width: 300px;
    height: 300px;
}

.status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: inline-block;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.status::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

.status:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status:hover::before {
    left: 100%;
}

.status.success {
    background: linear-gradient(135deg, #e2fbe8, #d4f8e8);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.status.danger {
    background: linear-gradient(135deg, #ffebeb, #ffe0e0);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.status.wait {
    background: linear-gradient(135deg, #fff3e0, #ffe8d6);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.status.pending {
    background: linear-gradient(135deg, #fff3e0, #ffe8d6);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.status.info {
    background: linear-gradient(135deg, #e3f2fd, #d9ebf7);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* Login */
.login-container {
    height: 100vh; display: flex; justify-content: center; align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}
.login-card { background: white; padding: 40px; border-radius: var(--border-radius); width: 400px; text-align: center; }
.input-group { text-align: right; margin-bottom: 15px; }
.input-group label { display: block; margin-bottom: 5px; }
.input-group input, .input-group select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
.btn-login { width: 100%; padding: 12px; background: var(--primary-color); color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* Tabs Control */
.tab-container { margin-bottom: 25px; }
.tabs-nav {
    display: flex;
    gap: 10px;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    width: fit-content;
}
.tab-btn {
    padding: 10px 25px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #636e72;
    transition: var(--transition);
}
.tab-btn.active {
    background: var(--primary-color);
    color: white;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Enhanced Support Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: #fdfdfd;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.message-bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.message-bubble.admin {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
}
.message-bubble.user {
    align-self: flex-start;
    background: white;
    color: var(--text-color);
    border-bottom-left-radius: 2px;
    border: 1px solid #e1e1e1;
}
.message-info {
    font-size: 0.75rem;
    margin-bottom: 4px;
    opacity: 0.8;
}
.message-time {
    font-size: 0.7rem;
    margin-top: 5px;
    text-align: left;
    display: block;
}

/* Modern Forms */
.form-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.form-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
