/* =========================================================
   Iron & Cladding Management System - Premium Arabic UI Theme
   ========================================================= */

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

:root {
    --primary-color: #0f4c81;
    --primary-dark: #0a3258;
    --primary-light: #e8f1f8;
    --accent-color: #f39c12;
    --accent-hover: #d68910;
    --steel-color: #4a6572;
    --cladding-color: #00897b;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #2980b9;
    --dark-bg: #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --card-bg: #ffffff;
    --body-bg: #f1f5f9;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
}

/* Layout Architecture */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: 270px;
    min-width: 270px;
    background: var(--sidebar-bg);
    color: #f8fafc;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 22px 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(15, 76, 129, 0.4), transparent);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.sidebar-brand span {
    line-height: 1.35;
    word-break: break-word;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 10px;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.sidebar-item {
    margin-bottom: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link i {
    width: 22px;
    font-size: 1.1rem;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-link.active i, .sidebar-link:hover i {
    color: var(--accent-color);
}

.sidebar-heading {
    padding: 16px 16px 6px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

/* Main Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--body-bg);
}

/* Navbar */
.app-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 100;
    position: sticky;
    top: 0;
}

.rate-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rate-badge i {
    color: #d97706;
}

/* Content Area */
.app-content {
    padding: 28px;
    flex: 1;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 24px;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.stat-card.primary { background: linear-gradient(135deg, #0f4c81, #1e3a8a); }
.stat-card.success { background: linear-gradient(135deg, #059669, #10b981); }
.stat-card.warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-card.danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-card.info { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.stat-card.dark { background: linear-gradient(135deg, #334155, #475569); }
.stat-card.cladding { background: linear-gradient(135deg, #0d9488, #14b8a6); }

.stat-val {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 4px 0;
}

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

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* Tables */
.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px 14px;
    font-size: 0.92rem;
    color: #334155;
    border-bottom: 1px solid var(--border-color);
}

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

/* Badges */
.badge {
    padding: 6px 10px;
    font-weight: 600;
    border-radius: 6px;
}

.badge-steel {
    background-color: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.badge-cladding {
    background-color: #ccfbf1;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

/* Buttons */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

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

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

.btn-accent {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #ffffff;
}

/* Forms */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #334155;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

/* =========================================================
   Modern POS Specific Components & Product Grid Styles
   ========================================================= */

.pos-category-btn {
    border-radius: 50px;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: #475569;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pos-category-btn:hover, .pos-category-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(15, 76, 129, 0.2);
}

.pos-product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.pos-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.pos-product-card:active {
    transform: scale(0.97);
}

.pos-product-card .prod-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 20px;
}

.pos-product-card .prod-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    margin-bottom: 4px;
    padding-left: 50px;
}

.pos-product-card .prod-code {
    font-size: 0.8rem;
    color: #64748b;
    font-family: monospace;
}

.pos-product-card .prod-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
}

.pos-product-card .prod-stock {
    font-size: 0.8rem;
    color: #475569;
}

/* POS Cart Table & Quantity Stepper */
.pos-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    overflow: hidden;
}

.pos-qty-stepper button {
    border: none;
    background: #f8fafc;
    width: 28px;
    height: 32px;
    font-weight: bold;
    color: #334155;
    transition: background 0.15s;
    cursor: pointer;
}

.pos-qty-stepper button:hover {
    background: #e2e8f0;
}

.pos-qty-stepper input {
    border: none;
    width: 50px;
    text-align: center;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 0;
    outline: none;
}

.pos-cart-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 90px;
}

.pos-summary-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.pos-total-display {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 992px) {
    .app-sidebar {
        position: fixed;
        right: -270px;
        top: 0;
        bottom: 0;
        height: 100%;
    }
    .app-sidebar.show {
        right: 0;
    }
    .app-content {
        padding: 16px;
    }
}
