:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #a855f7;
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite alternate;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #0ea5e9;
    top: 30%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
    margin-bottom: 2rem;
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

.nav-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--primary-glow);
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 2.5rem;
}

.section-header.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-muted);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-box.blue {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.icon-box.purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.icon-box.red {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.stat-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

/* Controls & Table */
.controls-bar {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}

.search-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    max-width: 400px;
    color: var(--text-muted);
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    width: 100%;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
}

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

th {
    text-align: left;
    padding: 1.2rem 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.3);
}

td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    color: #fff;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Product Cell */
.product-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-info div {
    font-weight: 500;
}

.product-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stock-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stock-badge.good {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.stock-badge.low {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    margin-right: 0.3rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #fff;
    color: #000;
}

.action-btn.delete {
    color: #f87171;
}

.action-btn.delete:hover {
    background: #f87171;
    color: #fff;
}

.action-btn.add-stock {
    color: #34d399;
}

.action-btn.add-stock:hover {
    background: #34d399;
    color: #fff;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: flex-start;
    /* Changed from center to allow scrolling */
    justify-content: center;
    overflow-y: auto;
    /* Enable scroll on backdrop */
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    /* Solid dark background */
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content.glass {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: none;
    /* Let the modal grow if needed, backdrop handles scroll */
    margin: auto;
    /* Vertically center if space permits, otherwise scroll */
}

.modal-content.glass::-webkit-scrollbar {
    width: 8px;
}

.modal-content.glass::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.modal-content.glass::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.modal-content.glass::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-content.small {
    max-width: 400px;
    text-align: center;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem;
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: all 0.3s;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.8rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-group select option {
    background: #1e293b;
    /* Solid dark background for options since glass doesn't work well here */
    color: #fff;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
}

/* Stock Movement Styling */
.product-preview {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.stock-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    /* Slight background for visibility */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stock-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    transition: all 0.2s;
}

.stock-btn.in {
    background: #10b981;
}

.stock-btn.in:hover {
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.stock-btn.out {
    background: #ef4444;
}

.stock-btn.out:hover {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.qty-display input {
    width: 80px;
    text-align: center;
    font-size: 2rem;
    background: transparent;
    border: none;
    color: #fff;
    font-weight: 700;
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* Glass Button (Secondary) */
.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    /* Slight fill */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    height: 48px;
    /* Force height match */
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-glass i {
    font-size: 0.9em;
    color: var(--text-muted);
    transition: color 0.3s;
}

.btn-glass:hover i {
    color: #fff;
}

/* Solid Reset Button (Matches Primary) */
.btn-reset-solid {
    background: #475569;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.4);
    height: 48px;
}

.btn-reset-solid:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    background: #334155;
}

/* Secondary Button (Standard) */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    /* Stealthy glass look */
    border: 1px solid var(--glass-border);
    color: #94a3b8;
    /* Text muted */
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}