/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Header ==================== */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    font-size: 1.8rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav a {
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
}
.nav a:hover {
    color: var(--primary);
}

.cart-link {
    position: relative;
}
.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.dropdown {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    padding: 8px 0;
}
.dropdown:hover .dropdown-menu {
    display: block;
}
.dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: var(--dark);
}
.dropdown-menu a:hover {
    background: var(--light);
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow);
    }
    .nav.active {
        display: flex;
    }
    .mobile-menu-btn {
        display: block;
    }
}

/* ==================== Main & Footer ==================== */
.main {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

.footer {
    background: var(--dark);
    color: white;
    padding: 50px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-col ul {
    list-style: none;
}
.footer-col li {
    margin-bottom: 8px;
}
.footer-col a {
    color: #94a3b8;
}
.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 20px;
    text-align: center;
    color: #64748b;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

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

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

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

/* ==================== Alerts ==================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error, .alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ==================== Cards ==================== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

/* ==================== Products Grid ==================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    height: 200px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-image .no-image {
    font-size: 4rem;
    color: #cbd5e1;
}

.product-info {
    padding: 20px;
}

.product-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--dark);
}
.product-title a {
    color: inherit;
}
.product-title a:hover {
    color: var(--primary);
}

.product-price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.product-price .original {
    text-decoration: line-through;
    color: var(--secondary);
    font-size: 0.9rem;
    font-weight: normal;
    margin-left: 8px;
}

.product-desc {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* ==================== Product Detail ==================== */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

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

.product-gallery {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
}

.product-main-image {
    width: 100%;
    height: 400px;
    background: #f1f5f9;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    overflow: hidden;
}
.product-main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-thumbs {
    display: flex;
    gap: 10px;
}
.product-thumb {
    width: 60px;
    height: 60px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}
.product-thumb:hover, .product-thumb.active {
    border-color: var(--primary);
}

.product-info-detail {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
}

.product-title-detail {
    font-size: 1.75rem;
    margin-bottom: 15px;
}

.product-price-detail {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 20px;
}

.product-sku {
    color: var(--secondary);
    margin-bottom: 20px;
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.quantity-input button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.quantity-input input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 1px solid var(--border);
    font-size: 1rem;
}

/* ==================== Cart ==================== */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th, .cart-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.cart-table th {
    background: var(--light);
    font-weight: 600;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-summary {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-top: 20px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-summary-row.total {
    font-size: 1.25rem;
    font-weight: bold;
    border-bottom: none;
}

/* ==================== Checkout ==================== */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

@media (max-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

.order-summary {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    position: sticky;
    top: 100px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* ==================== Orders ==================== */
.order-card {
    background: white;
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.order-number {
    font-weight: bold;
}

.order-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}
.status-paid, .status-processing {
    background: #dbeafe;
    color: #1e40af;
}
.status-shipped {
    background: #d1fae5;
    color: #065f46;
}
.status-delivered {
    background: #dcfce7;
    color: #166534;
}
.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.order-body {
    padding: 20px;
}

.tracking-box {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius);
    padding: 15px;
    margin-top: 15px;
}

.tracking-box h4 {
    color: #166534;
    margin-bottom: 10px;
}

/* ==================== Admin ==================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: var(--dark);
    color: white;
    padding: 20px 0;
}

.admin-sidebar .logo {
    color: white;
    padding: 0 20px 20px;
    border-bottom: 1px solid #334155;
    margin-bottom: 20px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #94a3b8;
    transition: all 0.3s;
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-content {
    flex: 1;
    background: #f1f5f9;
    padding: 30px;
}

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

.admin-header h1 {
    font-size: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--dark);
}

.stat-card .label {
    color: var(--secondary);
    font-size: 0.9rem;
}

.data-table {
    width: 100%;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
}

.data-table tr:hover {
    background: #f8fafc;
}

.action-btns {
    display: flex;
    gap: 5px;
}

/* ==================== Hero ==================== */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 80px 0;
    text-align: center;
    margin: -40px -20px 40px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

/* ==================== Utilities ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--secondary); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.d-flex { display: flex; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ==================== PayPal Button Container ==================== */
#paypal-button-container {
    margin-top: 20px;
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

.empty-state p {
    color: var(--secondary);
    margin-bottom: 20px;
}

/* ==================== Auth Pages ==================== */
.auth-container {
    max-width: 450px;
    margin: 0 auto;
}

.auth-box {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--secondary);
}

/* ==================== Responsive Tables ==================== */
@media (max-width: 768px) {
    .cart-table, .data-table {
        display: block;
        overflow-x: auto;
    }
}
