* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromTop {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Header */
.main-header {
    background: white;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    padding: 15px 30px;
    animation: slideInFromTop 0.6s ease-out;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 2em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 2s infinite;
}

.logo h2 {
    color: #333;
    font-size: 1.5em;
}

.header-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-badge {
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.staff-badge {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.btn-message {
    padding: 8px 15px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.btn-message .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.btn-message:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-logout {
    padding: 8px 20px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-logout:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Sidebar */
.main-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 260px;
    padding: 20px 0;
    animation: slideInFromLeft 0.6s ease-out;
    box-shadow: 2px 0 15px rgba(0,0,0,0.05);
}

.admin-sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
}

.staff-sidebar {
    background: linear-gradient(180deg, #11998e 0%, #16a085 100%);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-size: 1em;
}

.nav-item i {
    font-size: 1.2em;
    width: 25px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    border-left-color: white;
    transform: translateX(5px);
}

/* Content */
.content {
    flex: 1;
    padding: 30px;
    animation: slideInFromRight 0.6s ease-out;
}

.page-title {
    margin-bottom: 30px;
    animation: slideInFromTop 0.8s ease-out;
}

.page-title h1 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title h1 i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title p {
    color: #7f8c8d;
    font-size: 1em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    animation: scaleIn 0.6s ease-out;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: white;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-number small {
    font-size: 0.5em;
    color: #95a5a6;
}

.stat-info small {
    color: #95a5a6;
    font-size: 0.85em;
}

.stat-info small i {
    margin-right: 5px;
}

/* Quick Actions */
.quick-actions {
    margin-top: 40px;
    animation: slideInFromLeft 1s ease-out;
}

.quick-actions h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-actions h2 i {
    color: #f39c12;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.btn-action {
    padding: 25px;
    background: white;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-action i {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-action:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Alert Box */
.alert-box {
    padding: 20px;
    border-radius: 15px;
    margin-top: 30px;
    display: flex;
    gap: 15px;
    animation: scaleIn 0.8s ease-out;
}

.alert-box.info {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-left: 5px solid #2196f3;
}

.alert-box i {
    font-size: 2em;
    color: #2196f3;
}

.alert-box h3 {
    color: #1976d2;
    margin-bottom: 5px;
}

.alert-box p {
    color: #0d47a1;
    line-height: 1.6;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    animation: slideInFromLeft 0.8s ease-out;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}


/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Header */
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .logo h2 {
        font-size: 1.2em;
    }
    
    .header-nav {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .user-badge {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .btn-message, .btn-logout {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    /* Main Container */
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 10px 0;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .nav-item {
        padding: 12px 20px;
        border-left: none;
        border-bottom: 3px solid transparent;
        display: inline-flex;
    }
    
    .nav-item:hover, .nav-item.active {
        transform: translateX(0);
        border-left: none;
        border-bottom-color: white;
    }
    
    /* Content */
    .content {
        padding: 15px;
    }
    
    .page-title h1 {
        font-size: 1.5em;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }
    
    .stat-number {
        font-size: 1.5em;
    }
    
    /* Action Buttons */
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    .data-table {
        font-size: 0.85em;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    /* Forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Login Box */
    .login-box {
        padding: 25px;
        margin: 15px;
    }
    
    .logo-icon {
        font-size: 60px;
    }
    
    .login-box h1 {
        font-size: 1.8em;
    }
    
    /* Chat */
    .chat-container {
        height: 60vh;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    /* Medicine Sales Form */
    .medicine-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .medicine-row button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .page-title h1 {
        font-size: 1.3em;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }
    
    .stat-number {
        font-size: 1.3em;
    }
    
    .btn-action {
        padding: 20px 15px;
    }
    
    .btn-action i {
        font-size: 2em;
    }
    
    /* Hide table on very small screens, show cards instead */
    .data-table thead {
        display: none;
    }
    
    .data-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        padding: 10px;
    }
    
    .data-table td {
        display: block;
        text-align: left;
        padding: 8px;
        border: none;
    }
    
    .data-table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 100px;
    }
    
    /* Chat adjustments */
    .chat-input-area {
        flex-direction: column;
    }
    
    .chat-input {
        width: 100%;
    }
    
    .send-btn {
        width: 100%;
    }
}

/* Landscape mode for tablets */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print styles */
@media print {
    .main-header,
    .sidebar,
    .btn-action,
    .btn-primary,
    .btn-secondary,
    .btn-logout,
    .btn-message {
        display: none !important;
    }
    
    .content {
        padding: 0;
    }
    
    .stat-card {
        break-inside: avoid;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .nav-item,
    .btn-action,
    .btn-primary,
    .btn-secondary {
        min-height: 44px; /* iOS recommended touch target */
    }
    
    .btn-edit,
    .btn-delete,
    .btn-view {
        min-width: 44px;
        min-height: 44px;
    }
}
