/* نظام تسجيل أعمال مقاولي الباطن - style.css */
:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --text: #1e293b;
    --white: #ffffff;
    --border: #cbd5e1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    direction: rtl;
}

.hidden { display: none !important; }

/* Login Screen */
#login-screen {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-screen .card {
    width: 400px;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#login-screen input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
}

#login-screen input:focus {
    border-color: var(--primary-light);
}

/* Layout */
#app-container {
    width: 100%;
    height: 100vh;
    display: flex;
}

.sidebar {
    width: 280px;
    background: var(--white);
    border-left: 1px solid var(--border);
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
}

.sidebar h3 {
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
}

.nav-item {
    padding: 12px 18px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    color: #64748b;
    font-weight: 600;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: 0.3s;
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
    transform: translateX(-5px);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(30, 58, 138, 0.3);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Elements */
input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 5px;
    font-family: 'Tajawal';
    font-size: 14px;
    background: #fff;
    transition: 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

label {
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
    display: block;
    margin-bottom: 5px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Tajawal';
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: 0.2s;
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: #64748b;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: right;
    color: #64748b;
    font-size: 13px;
    padding: 12px 15px;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #f8fafc;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-info h3 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 5px;
}

.stat-info p {
    color: #64748b;
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: white;
    padding: 30px;
    width: 500px;
    max-width: 90%;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box.large {
    width: 700px;
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.single {
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 15px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Action Buttons in Table */
.action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    margin-left: 5px;
    transition: 0.2s;
}

.action-btn.edit {
    background: #dbeafe;
    color: #1e40af;
}

.action-btn.delete {
    background: #fee2e2;
    color: #991b1b;
}

.action-btn:hover {
    filter: brightness(0.95);
}

/* Filter Bar */
.filter-bar {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

/* User Info */
.user-info {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.user-info .name {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.user-info .role {
    font-size: 12px;
    color: #64748b;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    left: 30px;
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    color: #64748b;
    margin-bottom: 10px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.loading i {
    font-size: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Print */
@media print {
    .no-print { display: none !important; }
    .sidebar { display: none !important; }
    .page-body { padding: 0; max-width: 100%; }
}
