@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --success: #10B981;
    --success-hover: #059669;
    --warning: #F59E0B;
    --warning-hover: #D97706;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --bg-dark: #1E1E2E;
    --bg-card: #2D2D3F;
    --bg-input: #151521;
    --border-color: #3D3D52;
    --text-color: #FFFFFF;
    --text-muted: #9CA3AF;
    --sidebar-width: 250px;
    --transition-speed: 0.3s;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    z-index: 1000;
}

.logo-container {
    padding: 24px;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.user-profile {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

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

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 10px 5px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
}

.nav-link.danger-link {
    color: var(--danger);
}

.nav-link.danger-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
}

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

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

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

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

.btn-secondary { background-color: var(--bg-card); color: white; border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: var(--border-color); }

/* Dashboard Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform var(--transition-speed) ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.stat-icon.primary { background-color: rgba(59, 130, 246, 0.15); color: var(--primary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); }

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Dashboard Columns */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.card-panel {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-item {
    background-color: var(--bg-dark);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.panel-item-right {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    text-align: left;
}

.custom-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 14px 16px;
}

.custom-table th:first-child {
    border-top-left-radius: 8px;
}

.custom-table th:last-child {
    border-top-right-radius: 8px;
}

.custom-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.custom-table tbody tr {
    background-color: var(--bg-card);
    transition: background var(--transition-speed) ease;
}

.custom-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.custom-table tbody tr.low-stock {
    background-color: rgba(239, 68, 68, 0.08);
    color: #FCA5A5;
}

.custom-table tbody tr.low-stock td {
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

/* Filters and Search Bar */
.filter-bar {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    padding: 10px 14px;
    font-size: 0.9rem;
    outline: none;
    transition: border var(--transition-speed) ease;
}

.form-control:focus {
    border-color: var(--primary);
}

/* Login Page Styling */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-dark);
}

.login-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

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

.login-logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-group .form-control {
    width: 100%;
}

.remember-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    cursor: pointer;
}

.remember-group input {
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    animation: modalFadeIn var(--transition-speed) ease forwards;
}

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

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

.modal-title {
    font-weight: 700;
    font-size: 1.2rem;
}

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

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Product Form Layout Grid */
.product-form-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
}

.image-preview-container {
    background-color: var(--bg-dark);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 15px;
    overflow: hidden;
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Stock Cards selection layout */
.product-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 5px;
}

.product-select-card {
    background-color: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.product-select-card:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.product-select-card.selected {
    border-color: var(--primary);
    background-color: rgba(59, 130, 246, 0.08);
}

.select-card-img {
    height: 70px;
    background-color: var(--bg-card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
    overflow: hidden;
}

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

.select-card-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.select-card-qty {
    font-size: 0.75rem;
    font-weight: 700;
}

/* Alert Notification System */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.7;
}

.btn-close:hover {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }
    .logo-container span, .user-info, .menu-label, .nav-link span {
        display: none;
    }
    .nav-link {
        justify-content: center;
        padding: 12px;
    }
    .main-wrapper {
        margin-left: 70px;
    }
}

@media (max-width: 768px) {
    .product-form-grid {
        grid-template-columns: 1fr;
    }
}
