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

:root {
    /* Color Palette */
    --primary: #0056b3;         /* Bright Royal Blue matching the logo gear */
    --primary-light: #2563eb;   /* Vibrant Electric Blue */
    --primary-rgb: 0, 86, 179;
    --secondary: #f58220;       /* Golden Orange from logo */
    --secondary-hover: #e07216;
    --secondary-rgb: 245, 130, 32;
    
    /* Sleek Backgrounds */
    --bg-app: #f1f5f9;          /* Crisp slate-grey background (less dark than e2e8f0) */
    --card-bg: #ffffff;
    --sidebar-bg: linear-gradient(135deg, #0056b3 0%, #1e40af 100%); /* Vibrant blue gradient */
    
    /* Text Hierarchy */
    --text-main: #0f172a;       /* Very dark slate for maximum readability */
    --text-muted: #475569;     /* Deep slate grey */
    --border-color: #94a3b8;    /* Darker border for clear separation */
    
    /* Alert Statuses */
    --success: #059669;         /* Vibrant Emerald Green */
    --success-light: #d1fae5;
    --danger: #dc2626;          /* Vibrant Red */
    --danger-light: #fee2e2;
    --warning: #ea580c;         /* Orange Amber */
    --warning-light: #ffedd5;
    
    /* Design Details */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 20px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
    font-weight: 600; /* Bolder base font for visibility */
    font-size: 16px;  /* Increased base font size */
}

a {
    text-decoration: none;
    color: inherit;
}

/* Authentication Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: radial-gradient(circle at top right, rgba(245, 130, 32, 0.2) 0%, transparent 50%), 
                linear-gradient(135deg, #031b44 0%, #0c1a30 100%);
}

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    padding: 55px 45px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    text-align: center;
    border: 2px solid var(--primary);
}

.auth-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 25px;
}

.auth-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 10px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 35px;
    font-weight: 700;
}

/* Page Layout */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 320px; /* Wider sidebar */
    background: var(--sidebar-bg);
    color: white;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 100;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.25);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 45px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 25px;
}

.sidebar-logo h1 {
    font-size: 22px;
    font-weight: 900;
    color: white;
    text-align: center;
    margin-top: 15px;
}

.sidebar-logo p {
    font-size: 14px;
    color: var(--secondary);
    font-weight: 800;
    margin-top: 4px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 16px; /* Larger menu font */
    transition: var(--transition);
}

.menu-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--secondary);
}

.menu-item.active a {
    background: linear-gradient(90deg, rgba(245, 130, 32, 0.2) 0%, rgba(245, 130, 32, 0.05) 100%);
    color: var(--secondary);
    border-right: 5px solid var(--secondary);
    font-weight: 800;
}

.sidebar-footer {
    border-top: 2px solid rgba(255, 255, 255, 0.15);
    padding-top: 25px;
}

.user-info {
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
    font-weight: 700;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 2px solid rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Main Content Layout */
.main-content {
    margin-right: 320px;
    flex-grow: 1;
    padding: 50px;
    min-height: 100vh;
}

/* Header Sections */
.page-header {
    margin-bottom: 45px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 25px;
}

.page-title {
    font-size: 34px;
    font-weight: 900;
    color: var(--primary);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 16px;
    margin-top: 8px;
    font-weight: 700;
}

/* Interactive Dashboard Financial Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.stat-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border-top: 8px solid var(--primary);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

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

.stat-card.secondary {
    border-top-color: var(--secondary);
}

.stat-card.success {
    border-top-color: var(--success);
}

.stat-card.danger {
    border-top-color: var(--danger);
}

.stat-label {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 36px; /* Much larger font size */
    font-weight: 900; /* Heavy weight */
    letter-spacing: -0.5px;
}

/* Financial values color coding inside cards */
.stat-card .stat-value {
    color: var(--primary);
}
.stat-card.danger .stat-value {
    color: var(--danger);
}
.stat-card.success .stat-value {
    color: var(--success);
}
.stat-card.secondary .stat-value {
    color: var(--warning);
}

/* Premium Form Elements */
.form-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    border: 2px solid var(--border-color); /* Stronger border */
}

.form-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 30px;
    color: var(--primary);
    border-bottom: 3px solid var(--bg-app);
    padding-bottom: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.form-control {
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    background-color: #f8fafc;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 5px rgba(10, 61, 145, 0.15);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-miterlimit='10' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 18px center;
    background-size: 16px;
    padding-left: 50px;
    -webkit-appearance: none;
    appearance: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 5px 15px rgba(10, 61, 145, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(10, 61, 145, 0.4);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    box-shadow: 0 5px 15px rgba(245, 130, 32, 0.3);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 130, 32, 0.4);
}

.btn-outline-secondary {
    background-color: transparent;
    border: 2.5px solid var(--secondary);
    color: var(--secondary);
    box-shadow: none;
}

.btn-outline-secondary:hover {
    background-color: var(--secondary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 130, 32, 0.3);
}

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

.btn-danger:hover {
    background-color: #b91c1c;
    transform: translateY(-2px);
}

/* Supplier Profiles Grid */
.suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
}

.supplier-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 35px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.supplier-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.supplier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--bg-app);
    padding-bottom: 15px;
}

.supplier-name {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
}

.supplier-detail {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.supplier-detail svg {
    color: var(--primary-light);
}

.supplier-action {
    margin-top: 30px;
    display: flex;
}

/* Profile Workspace Header */
.supplier-profile-header {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    border: 2px solid var(--border-color);
    border-right: 8px solid var(--secondary);
}

/* Tab Switching Control Bar */
.tabs-nav {
    display: flex;
    list-style: none;
    background-color: #cbd5e1;
    border-radius: var(--radius-md);
    padding: 8px;
    margin-bottom: 40px;
    border: 2px solid var(--border-color);
    gap: 10px;
}

.tab-link {
    flex: 1;
    text-align: center;
    padding: 16px;
    font-weight: 800;
    font-size: 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.tab-link.active {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab-link:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables Styling */
.table-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: 25px;
    border: 2px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

th {
    background-color: var(--primary);
    color: white;
    padding: 20px 22px;
    font-weight: 800;
    font-size: 16px; /* Larger headers */
}

td {
    padding: 22px 24px;
    border-bottom: 1px solid #cbd5e1;
    font-size: 18px; /* Larger cell font size for better readability */
    color: var(--text-main);
    font-weight: 700; /* Bold numbers and texts */
}

tr:nth-child(even) td {
    background-color: #f1f5f9; /* Distinct shading distinct from white row */
}

tr:nth-child(odd) td {
    background-color: #ffffff;
}

tr:hover td {
    background-color: rgba(var(--primary-rgb), 0.08) !important; /* Prominent hover highlight */
}

/* Colored financial numbers in tables */
td strong {
    font-size: 17px;
    font-weight: 900;
}

/* Color utility classes for numbers */
.num-green {
    color: var(--success) !important;
}
.num-red {
    color: var(--danger) !important;
}
.num-orange {
    color: var(--warning) !important;
}
.num-blue {
    color: var(--primary) !important;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 2px solid rgba(5, 150, 105, 0.2);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 2px solid rgba(220, 38, 38, 0.2);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 2px solid rgba(234, 88, 12, 0.2);
}

/* Alert Messages */
.alert {
    padding: 20px 28px;
    border-radius: var(--radius-md);
    margin-bottom: 35px;
    font-weight: 800;
    font-size: 16px;
    border: 2px solid transparent;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border: 2px solid var(--success);
    border-right: 8px solid var(--success);
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 2px solid var(--danger);
    border-right: 8px solid var(--danger);
}

/* Search Bar Filters Layout */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-input {
    max-width: 320px;
}

/* Inline Debt Settling Forms */
.debt-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.debt-input {
    width: 110px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
}

.debt-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Responsive Scaling */
@media (max-width: 1200px) {
    .main-content {
        padding: 30px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 100px;
        padding: 30px 12px;
    }
    .sidebar-logo h1, .sidebar-logo p, .menu-item span, .user-info {
        display: none;
    }
    .sidebar-logo {
        margin-bottom: 30px;
        border-bottom: none;
        padding-bottom: 0;
    }
    .main-content {
        margin-right: 100px;
        padding: 30px 20px;
    }
    .menu-item a {
        justify-content: center;
        padding: 16px;
    }
}

/* Sidebar Page Themes */
.sidebar-index {
    background: linear-gradient(135deg, #0056b3 0%, #1e40af 100%);
}
.sidebar-customers, .sidebar-customer {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}
.sidebar-supplier {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}
.sidebar-item {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
}
.sidebar-edit {
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
}
.sidebar-settings {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}

