:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --danger: #ef4444;
    --border: #334155;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.menu-item {
    text-decoration: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.menu-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.menu-item.active {
    background-color: var(--primary);
    color: white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-weight: 600;
    font-size: 14px;
}

.user-info .role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    height: 80px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-dark);
    padding: 10px 16px;
    border-radius: 20px;
    width: 300px;
    border: 1px solid var(--border);
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
    font-family: 'Outfit';
}

.topbar-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.btn-icon:hover {
    color: white;
    border-color: var(--primary);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.content-wrapper {
    padding: 32px;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 4px;
}

/* Product Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.product-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.stock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.stock-badge.low {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.5);
}

.product-info {
    padding: 20px;
}

.product-code {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.product-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.2;
}

.product-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 15px;
    font-weight: 600;
}

.price-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-label {
    font-size: 12px;
    color: var(--text-muted);
}

.price-amount {
    font-size: 26px;
    font-weight: 800;
    color: var(--accent);
}

.actions {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-edit {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}
.btn-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-delete {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}
.btn-delete:hover {
    background: var(--danger);
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Forms & Tables for SaaS */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.form-control {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Outfit';
    outline: none;
    transition: 0.3s;
}
.form-control:focus {
    border-color: var(--primary);
}
.row {
    display: flex;
    gap: 16px;
}
.col {
    flex: 1;
}

/* Table styles */
.table-container {
    background-color: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    background-color: rgba(0,0,0,0.2);
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}
.text-right {
    text-align: right !important;
}

/* POS Layout (Point of Sale) */
.pos-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.pos-main {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.pos-sidebar {
    flex: 1;
    background-color: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    position: sticky;
    top: 104px;
}
.cart-items {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    align-items: center;
}
.cart-item-info {
    display: flex;
    flex-direction: column;
}
.cart-item-title {
    font-size: 14px;
    font-weight: 600;
}
.cart-item-price {
    font-size: 12px;
    color: var(--text-muted);
}
.cart-total {
    padding-top: 16px;
}
.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 16px;
}
.btn-block {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
}

/* Dashboard Metrics */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.metric-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 80px;
    opacity: 0.05;
    color: var(--text-main);
}
.metric-title {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.metric-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}
.metric-value.accent { color: var(--accent); }
.metric-value.primary { color: var(--primary); }

.metric-trend {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.metric-trend.up { color: var(--accent); }
.metric-trend.down { color: var(--danger); }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--bg-dark);
    width: 90%; max-width: 600px;
    border-radius: 16px; border: 1px solid var(--border);
    padding: 32px;
    transform: translateY(-20px);
    transition: transform 0.3s;
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-size: 22px; color: var(--primary); margin:0;}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; border-top: 1px solid var(--border); padding-top: 24px;}
