/* ===== نادر الشتيوي - التصميم العام (Royal Marine) ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #1a237e;
    --secondary-color: #c5a059;
    --accent-color: #ffd700;
    --bg-light: #f4f7f6;
    --text-dark: #2c3e50;
}

* {
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
}

.navbar {
    background: linear-gradient(90deg, #1a237e 0%, #283593 100%) !important;
    border-bottom: 3px solid var(--secondary-color);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--secondary-color) !important;
}

/* البطاقات */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background: #fff;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
    color: var(--primary-color);
    border-radius: 15px 15px 0 0 !important;
    padding: 15px 20px;
}

.stat-card {
    border-radius: 15px;
    padding: 25px;
    color: #fff;
    position: relative;
    overflow: hidden;
    border-left: 5px solid rgba(255,255,255,0.3);
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.stat-card .stat-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* شاشة تسجيل الدخول */
.login-page {
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.login-card {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
}

.login-header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: var(--secondary-color);
    text-align: center;
    padding: 40px;
    border-bottom: 4px solid var(--secondary-color);
}

.login-header h3 {
    font-weight: 700;
    color: #fff;
}

/* الجداول */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    color: var(--primary-color);
    border-top: none;
}

.table-hover tbody tr:hover {
    background-color: #f0f4ff;
}

/* أزرار */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #283593;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 35, 126, 0.3);
}

/* نقطة البيع */
.pos-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.pos-products {
    max-height: 600px;
    overflow-y: auto;
}

.pos-cart {
    background: #f8f9fa;
    min-height: 400px;
}

.pos-cart-header {
    background: #343a40;
    color: #fff;
    padding: 15px;
    font-weight: 600;
}

.pos-cart-items {
    max-height: 300px;
    overflow-y: auto;
}

.pos-total {
    background: #28a745;
    color: #fff;
    padding: 15px;
    font-size: 1.5rem;
    font-weight: 700;
}

.product-card {
    cursor: pointer;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.product-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-3px);
}

.product-card .product-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 5px;
}

.product-card .product-price {
    color: #28a745;
    font-weight: 700;
    font-size: 1.1rem;
}

/* التذييل */
.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.85rem;
}

/* استجابة للأجهزة (Mobile Optimization) */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--primary-color);
        padding: 20px;
        border-radius: 0 0 15px 15px;
        margin-top: 10px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    }
    
    .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    .stat-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .stat-card .stat-number {
        font-size: 1.4rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .card-header {
        padding: 12px 15px;
    }

    h2, h3 {
        font-size: 1.5rem;
    }

    /* تحسين نقطة البيع للهواتف */
    .pos-products {
        max-height: 400px;
    }

    .product-card {
        padding: 10px;
    }

    .product-card .product-name {
        font-size: 0.8rem;
    }

    .product-card .product-price {
        font-size: 1rem;
    }

    .pos-total {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .stat-card .stat-label {
        font-size: 0.85rem;
    }
    
    .btn-lg {
        padding: 12px;
        font-size: 1rem;
    }

    .table th, .table td {
        font-size: 0.85rem;
        padding: 8px 5px;
    }
}

/* تحسين مظهر النماذج */
.form-control, .form-select {
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 15px;
    transition: all 0.2s ease-in-out;
    background-color: #fcfcfc;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1);
    background-color: #fff;
    transform: scale(1.01);
}

.input-group-text {
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px !important;
    color: var(--primary-color);
    padding: 0 15px;
}

.input-group > .form-control, .input-group > .form-select {
    border-radius: 12px !important;
}

.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-right: -1.5px;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* أزرار الحفظ */
.btn-primary {
    background: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
    box-shadow: 0 4px 10px rgba(26, 35, 126, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.2);
}

/* رسائل الخطأ */
.alert {
    border-radius: 15px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: slideIn 0.4s ease-out;
}

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

/* تحسينات إضافية */
.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #475569;
}

.text-danger {
    color: #ef4444 !important;
}

/* تحسين الجداول */
.table-responsive {
    border-radius: 15px;
    overflow: hidden;
}

/* نقطة البيع - تحسين السلة */
.pos-cart-items {
    min-height: 250px;
}

.cart-item-row:hover {
    background-color: #f8fafc;
}

.pos-total {
    border-radius: 0 0 15px 15px;
    margin-top: auto;
}

/* ===== فاتورة الطباعة ===== */
.invoice-print {
    max-width: 350px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    font-size: 13px;
}

.invoice-print .inv-header {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 2px dashed #333;
    padding-bottom: 10px;
}

.invoice-print .inv-header h4 {
    font-weight: 700;
    margin-bottom: 5px;
}

.invoice-print .inv-info {
    margin-bottom: 10px;
}

.invoice-print .inv-info table {
    width: 100%;
    font-size: 12px;
}

.invoice-print .inv-info td {
    padding: 2px 0;
}

.invoice-print .inv-items {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.invoice-print .inv-items th,
.invoice-print .inv-items td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: center;
}

.invoice-print .inv-items th {
    background: #f0f0f0;
    font-weight: 600;
}

.invoice-print .inv-total {
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 2px solid #333;
}

.invoice-print .inv-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 11px;
    color: #666;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
}

@media print {
    nav.navbar { display: none !important; }
    .container-fluid > :not(.invoice-print) { display: none !important; }
    .container-fluid { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
    .invoice-print { padding: 10px; }
    .invoice-print .no-print { display: none !important; }
    .inv-header { text-align: center; margin-bottom: 15px; }
    .inv-header h4 { margin: 0; font-size: 16px; }
    .inv-info { margin-bottom: 10px; }
    .inv-info table { width: 100%; font-size: 12px; }
    .inv-items { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 12px; }
    .inv-items th, .inv-items td { border: 1px solid #000; padding: 4px 6px; text-align: center; }
    .inv-items th { background: #f0f0f0; font-weight: bold; }
    .inv-total { text-align: left; font-size: 14px; font-weight: bold; margin-bottom: 10px; }
    .inv-footer { text-align: center; font-size: 12px; color: #666; }
}
