:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: #5568d3;
    --accent-color: #f093fb;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --bg-light: #f7fafc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header Styles */
.site-header {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.site-header .brand {
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    transition: transform 0.3s ease;
}

.site-header .brand:hover {
    transform: scale(1.05);
}

.site-header .btn {
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(5px);
}

.site-header .btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: white;
    transform: translateY(-2px);
}

/* Ensure header/action buttons (like "الأصناف") show white text on the colored header */
.site-header .btn,
.site-header a.btn,
.site-header .btn-outline-secondary,
.site-header a.btn-outline-secondary {
    color: white !important;
    border-color: rgba(255,255,255,0.22) !important;
}
.site-header .btn .bi,
.site-header a .bi {
    color: white !important;
}
.site-header a.btn.btn-outline-secondary:hover {
    background: rgba(255,255,255,0.12) !important;
}

/* Card Styles */
.card-modern {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-modern:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-modern h3 {
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #667eea;
    display: inline-block;
}

/* Form Controls */
.form-control, .form-select, .form-floating > .form-control {
    border-radius: var(--radius-sm);
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(56,239,125,0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56,239,125,0.4);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* Table Styles */
.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.table thead th {
    border: none;
    padding: 1rem 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    transform: scale(1.01);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table tbody td a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.table tbody td a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Utility Classes */
.small-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nowrap {
    white-space: nowrap;
}

.footer-note {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Footer Styles */
.site-footer {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #cbd5e0;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.site-footer .brand {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-footer .contact {
    font-size: 0.95rem;
}

.site-footer .phone {
    direction: ltr;
    display: inline-block;
    color: #f093fb;
    font-weight: 600;
}

.site-footer a {
    color: #cbd5e0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: white;
}

.site-footer .btn {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
}

.site-footer .btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: white;
}

/* Item Row Styles */
.item-row {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border-right: 4px solid #667eea;
    transition: all 0.3s ease;
}

.item-row:hover {
    background: #e9ecef;
    transform: translateX(-5px);
}

/* Alert Styles */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 1rem 1.25rem;
}

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.alert-success {
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
    color: white;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .hide-sm {
        display: none !important;
    }
    
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .site-header .brand {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .site-header > div > div {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .site-header .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .card-modern {
        margin: 0.5rem;
        padding: 1rem !important;
    }
    
    .card-modern h3 {
        font-size: 1.25rem;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn:not(.site-header .btn):not(.site-footer .btn) {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .site-footer {
        padding: 2rem 0 1.5rem;
        margin-top: 2rem;
    }
    
    .site-footer .container {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .site-footer .brand {
        font-size: 1.5rem;
    }
    
    .site-footer .contact {
        font-size: 0.85rem;
    }
    
    .item-row {
        padding: 0.75rem;
    }
    
    .row.g-3 {
        margin: 0 !important;
    }
    
    .row.g-3 > * {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .site-header .brand {
        font-size: 1.1rem;
    }
    
    .card-modern h3 {
        font-size: 1.1rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    main.container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

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

.card-modern {
    animation: fadeInUp 0.5s ease-out;
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 3px solid rgba(102,126,234,0.5);
    outline-offset: 2px;
}

