/* ========================================
   Global Styles & Variables
   ======================================== */

:root {
    /* Colors - Based on Logo */
    --primary-color: #3D5A94;
    --primary-dark: #2A4070;
    --primary-light: #5176B8;
    --secondary-color: #E89A3C;
    --secondary-dark: #D58520;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #111827;
    
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --success-color: #10b981;
    --warning-color: #E89A3C;
    --error-color: #ef4444;
    --info-color: #3D5A94;
    
    /* Typography */
    --font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Developer Credit */
    --developer-bg: #f8f9fa;
    --developer-text: #6b7280;
    --developer-link: #3D5A94;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ========================================
   Reset & Base Styles
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   Layout & Container
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    width: 100%;
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

section {
    padding: var(--spacing-2xl) 0;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: var(--font-size-base);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.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:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(61, 90, 148, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: 0 6px 20px rgba(61, 90, 148, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #FFB84D);
    color: white;
    box-shadow: 0 4px 15px rgba(232, 154, 60, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary-color));
    box-shadow: 0 6px 20px rgba(232, 154, 60, 0.4);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    position: relative;
}

.btn-outline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    transition: width var(--transition-base);
    z-index: -1;
}

.btn-outline:hover:not(:disabled) {
    color: white;
    border-color: var(--primary-light);
}

.btn-outline:hover:not(:disabled)::after {
    width: 100%;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-secondary);
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: var(--font-size-lg);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

/* ========================================
   Forms
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-label.required::after {
    content: " *";
    color: var(--error-color);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(61, 90, 148, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--error-color);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--error-color);
}

.form-help {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.checkbox,
.radio {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 0;
}

.card-body {
    padding: var(--spacing-md) 0;
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* ========================================
   Badges & Pills
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-primary {
    background-color: rgba(61, 90, 148, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--info-color);
    color: var(--info-color);
}

/* ========================================
   Loading & Spinner
   ======================================== */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========================================
   Utilities
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }

/* ========================================
   Responsive Design
   ======================================== */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
        padding: 0 var(--spacing-xl);
    }
}

/* Desktop (1200px - 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
    .container {
        max-width: 1140px;
        padding: 0 var(--spacing-lg);
    }
}

/* Tablet Landscape & Small Desktop (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* Tablet Portrait & Small Desktop (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
    
    .btn {
        min-height: 44px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
    }
}

/* Mobile Landscape & Small Tablet (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .btn {
        min-height: 44px;
    }
}

/* Mobile Portrait (up to 767px) */
@media (max-width: 767px) {
    :root {
        --font-size-4xl: 1.875rem;
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.25rem;
        --font-size-xl: 1.125rem;
        --font-size-lg: 1rem;
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .container-fluid {
        padding: 0 var(--spacing-md);
    }
    
    section {
        padding: var(--spacing-xl) 0;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: var(--font-size-sm);
        min-height: 44px; /* Touch target */
        width: auto;
    }
    
    .btn-large {
        padding: 0.75rem 1.5rem;
        font-size: var(--font-size-base);
        min-height: 48px;
    }
    
    /* Cards */
    .card {
        padding: var(--spacing-md);
    }
    
    /* Forms */
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem;
        font-size: var(--font-size-sm);
        min-height: 44px; /* Touch target */
    }
    
    /* Utilities */
    .d-flex {
        flex-wrap: wrap;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    :root {
        --font-size-4xl: 1.5rem;
        --font-size-3xl: 1.25rem;
        --font-size-2xl: 1.125rem;
        --font-size-xl: 1rem;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .container-fluid {
        padding: 0 var(--spacing-sm);
    }
    
    section {
        padding: var(--spacing-lg) 0;
    }
    
    /* Typography */
    h1 { font-size: var(--font-size-3xl); }
    h2 { font-size: var(--font-size-2xl); }
    h3 { font-size: var(--font-size-xl); }
    h4 { font-size: var(--font-size-lg); }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 0.875rem;
        font-size: var(--font-size-sm);
        width: 100%;
        min-height: 48px;
    }
    
    .btn-large {
        padding: 0.75rem 1.25rem;
        font-size: var(--font-size-base);
        min-height: 48px;
    }
    
    /* Cards */
    .card {
        padding: var(--spacing-sm);
    }
    
    .card-header,
    .card-footer {
        padding: var(--spacing-sm) 0;
    }
    
    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem;
        font-size: var(--font-size-sm);
        min-height: 48px;
    }
    
    .form-textarea {
        min-height: 100px;
    }
    
    /* Badges */
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: var(--font-size-xs);
        min-height: 24px;
    }
    
    /* Alerts */
    .alert {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
    
    /* Checkbox and Radio */
    .checkbox,
    .radio {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }
}

/* Extra Small Mobile (up to 360px) */
@media (max-width: 360px) {
    :root {
        --font-size-4xl: 1.25rem;
        --font-size-3xl: 1.125rem;
        --font-size-2xl: 1rem;
    }
    
    .container {
        padding: 0 var(--spacing-xs);
    }
    
    .container-fluid {
        padding: 0 var(--spacing-xs);
    }
    
    section {
        padding: var(--spacing-md) 0;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: var(--font-size-xs);
    }
}

/* Landscape Orientation for Mobile */
@media (max-width: 767px) and (orientation: landscape) {
    section {
        padding: var(--spacing-md) 0;
    }
    
    .hero {
        padding: 2rem 0;
    }
}

/* iPad Specific (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* iPhone X and newer (375px - 414px) */
@media (min-width: 375px) and (max-width: 414px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    a,
    button {
        -webkit-tap-highlight-color: rgba(61, 90, 148, 0.2);
        touch-action: manipulation;
    }
    
    .btn:active,
    button:active {
        transform: scale(0.98);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Increase touch targets */
    .checkbox,
    .radio {
        min-width: 24px;
        min-height: 24px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   Developer Credit
   ======================================== */

.developer-credit {
    background: var(--developer-bg);
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.developer-credit-content {
    color: var(--developer-text);
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.developer-credit-content:hover {
    color: var(--developer-link, #007bff);
    transform: translateY(-2px);
    opacity: 0.9;
}

.developer-logo {
    height: 16px;
    width: 16px;
    min-width: 16px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

/* For auth pages */
.auth-page .developer-credit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
}

/* For dashboard pages */
.dashboard-layout .developer-credit {
    grid-column: 1 / -1;
    margin-top: 2rem;
}

