/* Ordering System - Main Stylesheet */

/* CSS Variables */
:root {
    --primary: #4361ee;
    --primary-dark: #3f37c9;
    --secondary: #3f37c9;
    --accent: #f72585;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #2b2d42;
    --text-secondary: #8d99ae;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef476f;
    --sidebar: #1a1a2e;
    --sidebar-hover: #16213e;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Poppins', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Typography */
h1 {
    font-size: 32px;
    font-weight: 700;
}

h2 {
    font-size: 24px;
    font-weight: 600;
}

h3 {
    font-size: 20px;
    font-weight: 600;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* Layout */
/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.5)),
                url('../../assets/images/background.jpg');
    background-size: cover;
    background-position: center;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 48px;
    width: 100%;
    max-width: 450px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    color: var(--primary);
    font-size: 28px;
}

.auth-logo p {
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 22px;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sidebar-menu {
    padding: 16px 0;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-menu-item:hover,
.sidebar-menu-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 3px solid var(--primary);
}

.sidebar-menu-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    background: var(--background);
}

/* Header */
.top-header {
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-title h2 {
    font-size: 20px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    text-align: right;
}

.user-info strong {
    display: block;
    font-size: 14px;
}

.user-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.btn-logout {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #d63d5e;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(6, 214, 160, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(255, 209, 102, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger);
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

textarea.form-control {
    height: auto;
    min-height: 120px;
    padding: 12px 16px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238d99ae' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #05b88a;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d63d5e;
}

.btn-warning {
    background: var(--warning);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--background);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: #f8f9fa;
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-transform: capitalize;
}

.badge-pending {
    background: rgba(255, 209, 102, 0.2);
    color: #b8860b;
}

.badge-processing {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.badge-shipped {
    background: rgba(63, 55, 201, 0.1);
    color: var(--secondary);
}

.badge-delivered {
    background: rgba(6, 214, 160, 0.1);
    color: #05a77a;
}

.badge-cancelled {
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger);
}

.badge-active {
    background: rgba(6, 214, 160, 0.1);
    color: #05a77a;
}

.badge-inactive {
    background: rgba(141, 153, 174, 0.2);
    color: var(--text-secondary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--background);
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.product-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.product-stock {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.product-stock.in-stock {
    color: var(--success);
}

.product-stock.low-stock {
    color: var(--warning);
}

.product-stock.out-of-stock {
    color: var(--danger);
}

/* Cart */
.cart-container {
    max-width: 900px;
    margin: 0 auto;
}

.cart-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.cart-item-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 12px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--background);
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quantity-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cart-item-total {
    text-align: right;
}

.cart-item-total .price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.cart-summary {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 24px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-summary-row:last-child {
    border-bottom: none;
    font-size: 20px;
    font-weight: 700;
}

.cart-summary-row.total {
    color: var(--primary);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(6, 214, 160, 0.1);
    color: #05a77a;
    border: 1px solid rgba(6, 214, 160, 0.3);
}

.alert-danger {
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 71, 111, 0.3);
}

.alert-warning {
    background: rgba(255, 209, 102, 0.1);
    color: #b8860b;
    border: 1px solid rgba(255, 209, 102, 0.3);
}

.alert-info {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    border: 1px solid rgba(67, 97, 238, 0.3);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.pagination-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-item:hover,
.pagination-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--background);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Search */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-input {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Filter */
.filter-group {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.action-btn.edit {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.action-btn.edit:hover {
    background: var(--primary);
    color: white;
}

.action-btn.delete {
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: white;
}

.action-btn.view {
    background: rgba(6, 214, 160, 0.1);
    color: var(--success);
}

.action-btn.view:hover {
    background: var(--success);
    color: white;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 999;
        width: 250px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .auth-card {
        padding: 32px 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .cart-item {
        flex-direction: column;
    }
    
    .cart-item-image {
        width: 100%;
        height: 180px;
    }
    
    .top-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .header-user {
        width: 100%;
        justify-content: space-between;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    /* Mobile touch improvements */
    .btn, 
    .action-btn,
    .quantity-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control {
        height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .sidebar {
        width: 100%;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        padding: 16px;
    }
    
    .table th, 
    .table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-content h3 {
        font-size: 24px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Image Preview */
.image-preview {
    width: 100%;
    max-width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    display: none;
}

.image-preview.show {
    display: block;
}
