:root {
    --primary-purple: #8b5cf6;
    --dark-purple: #6d28d9;
    --light-purple: #a78bfa;
    --neon-purple: #c084fc;
    --bg-dark: #1a1a2e;
    --bg-card: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f9fafb;
    color: var(--text-dark);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark-purple) 0%, var(--primary-purple) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(139, 92, 246, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* Desktop: sidebar hidden state */
.sidebar.sidebar-hidden {
    transform: translateX(-100%);
}

/* Desktop: main content adjustment when sidebar is hidden */
.sidebar.sidebar-hidden ~ .main-content {
    margin-left: 0;
    width: 100%;
}

.logo {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
    color: var(--neon-purple);
    text-shadow: 0 0 20px var(--neon-purple);
}

.logo h2 {
    font-size: 24px;
    font-weight: 700;
}

.nav-menu {
    padding: 20px 0 100px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    padding: 20px 20px 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(192, 132, 252, 0.3);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--neon-purple);
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.4);
}

.user-info {
    position: relative;
    width: 100%;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    flex-shrink: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
}

.user-info i.fa-user-circle {
    font-size: 32px;
    flex-shrink: 0;
}

.user-info span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.logout-btn {
    margin-left: auto;
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 30px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.content-wrapper {
    max-width: 1400px;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-light);
    font-size: 16px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-purple);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

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

.stat-card {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    color: white;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

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

.stat-card-content {
    position: relative;
    z-index: 1;
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.9;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    color: white;
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: #f9fafb;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark-purple) 0%, var(--primary-purple) 100%);
    margin: 0;
    width: 100%;
}

.login-card {
    background: white;
    padding: 48px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header i {
    font-size: 64px;
    color: var(--primary-purple);
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

/* Receipt */
.receipt {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    border: 2px dashed var(--primary-purple);
    background: white;
    font-family: 'Courier New', monospace;
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-purple);
    padding-bottom: 15px;
}

.receipt-items {
    margin: 20px 0;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 5px 0;
}

.receipt-total {
    border-top: 2px solid var(--primary-purple);
    margin-top: 15px;
    padding-top: 15px;
    font-weight: bold;
    font-size: 18px;
}

.receipt-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    font-size: 12px;
}

/* Product Search */
.product-search {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-purple);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background: #f3f4f6;
    border-left: 3px solid var(--primary-purple);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--dark-purple) 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    font-size: 20px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* When sidebar is hidden, move toggle to left */
.sidebar.sidebar-hidden ~ .sidebar-toggle {
    left: 20px;
}

/* When sidebar is visible, move toggle to right of sidebar */
.sidebar:not(.sidebar-hidden) ~ .sidebar-toggle {
    left: 280px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .sidebar,
    .sidebar-toggle,
    .btn,
    .filter-bar,
    .page-header,
    .action-buttons {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 0;
    }

    .receipt {
        border: 2px solid black;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}

/* Responsive Styles */

/* Tablets and below */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 12px 8px;
    }
}

/* Mobile Landscape and Portrait */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Override desktop hidden state on mobile */
    .sidebar.sidebar-hidden {
        transform: translateX(-100%);
    }

    .sidebar-toggle {
        left: 20px !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 90px 15px 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-icon {
        font-size: 32px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
        min-width: 600px;
    }

    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    .filter-bar {
        flex-direction: column;
        gap: 12px;
    }

    .filter-bar .form-group {
        width: 100%;
        margin-bottom: 0;
    }

    .action-buttons {
        flex-direction: column;
        gap: 6px;
    }

    .btn-sm {
        width: 100%;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .page-header p {
        font-size: 14px;
    }

    /* Form adjustments */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Grid layouts */
    div[style*="grid-template-columns"] {
        display: block !important;
    }

    div[style*="grid-template-columns"] > * {
        margin-bottom: 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .sidebar-toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
        top: 15px;
        left: 15px;
    }

    .main-content {
        padding: 80px 10px 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .card-header h2 {
        font-size: 16px;
    }

    table {
        font-size: 11px;
    }
}

/* Large Screens */
@media (min-width: 1440px) {
    .main-content {
        padding: 40px;
    }

    .content-wrapper {
        max-width: 1600px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra Large Screens */
@media (min-width: 1920px) {
    .content-wrapper {
        max-width: 1800px;
    }

    .page-header h1 {
        font-size: 40px;
    }

    .stat-value {
        font-size: 40px;
    }
}
