/* Modern Dental Lab SaaS Design System */
:root {
    /* Color Palette */
    --primary: #2563eb;
    /* Royal Blue */
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    /* Slate 900 */
    --accent: #10b981;
    /* Emerald */
    --danger: #ef4444;
    /* Red */
    --warning: #f59e0b;
    /* Amber */

    /* Backgrounds */
    --bg-body: #f3f4f6;
    /* Gray 100 */
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);

    /* Text */
    --text-main: #1f2937;
    /* Gray 800 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --text-light: #9ca3af;
    /* Gray 400 */

    /* Spacing */
    --spacing-xs: 0.25rem;
    /* 4px */
    --spacing-sm: 0.5rem;
    /* 8px */
    --spacing-md: 1rem;
    /* 16px */
    --spacing-lg: 1.5rem;
    /* 24px */
    --spacing-xl: 2rem;
    /* 32px */

    /* Border Radius */
    --radius-sm: 0.375rem;
    /* 6px */
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);

    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

/* -----------------------------------------------------------------------------
   Reset & Base Styles
----------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* -----------------------------------------------------------------------------
   Layout Utilities
----------------------------------------------------------------------------- */
.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.main-content {
    flex: 1;
    padding: var(--spacing-xl) 0;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

/* -----------------------------------------------------------------------------
   Typography
----------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--secondary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Components: Navbar
----------------------------------------------------------------------------- */
.main-navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    box-shadow: var(--shadow-sm);
}

.main-navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.nav-item {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
    position: relative;
    padding: var(--spacing-xs) 0;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-item:hover::after,
.nav-item.active::after {
    width: 100%;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-name {
    font-weight: 700;
    color: var(--secondary);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.875rem;
    font-weight: 600;
    background: #e0e7ff;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    color: var(--primary);
}

.lang-switcher a:hover {
    text-decoration: underline;
}

.logout-btn,
.login-btn {
    color: var(--danger);
}

.logout-btn:hover {
    color: #dc2626;
}

.login-btn {
    color: var(--primary);
}

/* -----------------------------------------------------------------------------
   Components: Buttons
----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    gap: var(--spacing-sm);
    line-height: 1;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* -----------------------------------------------------------------------------
   Components: Cards
----------------------------------------------------------------------------- */
.card,
.form-card,
.invoice-card,
.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* -----------------------------------------------------------------------------
   Components: Forms
----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-body);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: white;
}

/* -----------------------------------------------------------------------------
   Components: Tables
----------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: var(--spacing-md);
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

[dir="rtl"] th {
    text-align: right;
}

td {
    padding: var(--spacing-md);
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

/* -----------------------------------------------------------------------------
   Components: Badges/Status
----------------------------------------------------------------------------- */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: inline-block;
}

/* Status variants */
.status-received,
.status-open {
    background: #dbeafe;
    color: #1e40af;
}

.status-in_progress,
.status-partially_paid {
    background: #ede9fe;
    color: #6b21a8;
}

.status-ready,
.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.status-delivered {
    background: #dcfce7;
    color: #166534;
}

.status-cancelled,
.status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.status-remake {
    background: #ffedd5;
    color: #c2410c;
}

/* -----------------------------------------------------------------------------
   Components: Auth Pages
----------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: var(--spacing-md);
}

.auth-container {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-container h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: var(--spacing-xl);
}

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Page Specific: Dashboard
----------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

/* -----------------------------------------------------------------------------
   Specific: Clinic Dashboard
----------------------------------------------------------------------------- */
.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.balance-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.balance-card.good {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.balance-amount {
    font-size: 3rem;
    font-weight: 800;
    margin: var(--spacing-md) 0;
    line-height: 1;
}

.credit-limit {
    opacity: 0.9;
    font-size: 0.875rem;
}

/* -----------------------------------------------------------------------------
   Specific: Technician Dashboard
----------------------------------------------------------------------------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.filter-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.case-card {
    background: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.case-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid #f3f4f6;
}

.case-actions {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* -----------------------------------------------------------------------------
   Specific: Landing Page
----------------------------------------------------------------------------- */
.landing-page .hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6rem var(--spacing-md);
    text-align: center;
    border-radius: var(--radius-lg);
    margin: 0 var(--spacing-md) var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.hero .subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: var(--spacing-xl);
    color: rgba(255, 255, 255, 0.9);
}

.cta-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.section-content {
    padding: var(--spacing-xl) 0;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.portfolio-preview {
    text-align: center;
    padding: var(--spacing-xl) 0;
}

.view-all {
    display: inline-block;
    color: var(--primary);
    font-weight: 700;
    margin-top: var(--spacing-md);
}

/* -----------------------------------------------------------------------------
   Responsive Mobile
----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .main-navbar .container {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-sm);
    }

    .nav-item {
        width: 100%;
        text-align: center;
        padding: var(--spacing-sm);
        background: rgba(255, 255, 255, 0.5);
        border-radius: var(--radius-md);
    }

    .nav-divider {
        display: none;
    }

    .user-menu {
        flex-direction: column;
        margin-top: var(--spacing-sm);
    }
}