:root {
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --border-color: #334155;
    --hover-bg: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-purple);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.sidebar-nav li:hover {
    background-color: var(--hover-bg);
    color: var(--text-main);
}

.sidebar-nav li.active {
    background-color: var(--accent-purple);
    color: white;
}

.sidebar-footer {
    padding: 1rem 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.search-container {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 400px;
    gap: 0.75rem;
}

.search-container input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.search-container i {
    color: var(--text-muted);
    width: 18px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent-purple);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.purple { background-color: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }
.stat-icon.blue { background-color: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.stat-icon.red { background-color: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

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

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.activity-list, .alert-list {
    list-style: none;
    padding: 0;
}

.activity-item, .alert-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child, .alert-item:last-child {
    border-bottom: none;
}

.item-main {
    display: flex;
    flex-direction: column;
}

.item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.item-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-item {
    border-left: 4px solid var(--accent-red);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.stock-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.stock-low {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.stock-normal {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-purple);
    color: white;
}

.btn-primary:hover {
    background-color: #7c3aed;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--hover-bg);
    color: var(--text-main);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-muted);
}

.btn-icon:hover {
    color: var(--text-main);
}

.btn-icon.edit:hover { color: var(--accent-blue); }
.btn-icon.delete:hover { color: var(--accent-red); }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 500px;
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease-out;
}

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

.hidden { display: none !important; }

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

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

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

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

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

input, select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-main);
    outline: none;
}

input:focus {
    border-color: var(--accent-purple);
}

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

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    background-color: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--accent-purple);
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 10px 0 15px rgba(0,0,0,0.5);
    }

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

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .menu-toggle {
        display: block;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header-row .btn {
        width: 100%;
        justify-content: center;
    }

    .search-filter-wrapper {
        flex-direction: column;
    }

    .search-filter-wrapper .filter-group {
        width: 100%;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-info p {
        font-size: 1.25rem;
    }

    .modal {
        padding: 1.5rem;
        margin: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

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

.inventory-controls {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

@media (max-width: 600px) {
    .hide-mobile {
        display: none !important;
    }

    table {
        font-size: 0.75rem;
    }

    td, th {
        padding: 0.75rem 0.4rem;
    }

    .item-name {
        font-size: 0.8rem;
    }

    .stock-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
}
