/* ========================================
   NextGen OCR - Main Stylesheet
   Color scheme: Dark theme with teal/cyan accents
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0096c7;
    --primary-dark: #0077b6;
    --primary-light: #48cae4;
    --accent: #00b4a0;
    --bg-dark: #eef2f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f6fc;
    --bg-input: #f4f7fa;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #8899a8;
    --border: #dce3ed;
    --error: #e53e3e;
    --success: #38a169;
    --warning: #d69e2e;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* RTL Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(252, 92, 101, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-success {
    background: rgba(38, 222, 129, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand svg {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(0, 180, 216, 0.1);
}

.nav-lang {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    margin-right: 8px;
}

body.rtl .nav-lang {
    margin-left: 8px;
    margin-right: 8px;
}

.lang-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    transition: var(--transition);
}

.lang-btn:hover,
.lang-btn.active {
    color: var(--text-primary);
    background: var(--primary);
}

.nav-logout {
    margin-left: 8px;
}

body.rtl .nav-logout {
    margin-left: 0;
    margin-right: 8px;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #e8f0fa 0%, #f0f4f8 50%, #e3ecf5 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 150, 199, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 180, 160, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 150, 199, 0.06) 0%, transparent 50%);
    animation: bgShift 20s ease infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-5%, -5%); }
}

.login-overlay {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-lang {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 12px;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-form .btn {
    margin-top: 8px;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-card) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(0, 180, 216, 0.08) 0%, transparent 70%);
}

.hero h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    position: relative;
}

.hero .btn {
    position: relative;
}

/* ========================================
   Steps Section
   ======================================== */
.steps-section {
    padding: 60px 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.step-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.step-number {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.step-icon {
    color: var(--primary);
    margin-bottom: 16px;
}

.step-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.step-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   Categories Section
   ======================================== */
.categories-section {
    padding: 60px 0;
    background: var(--bg-card);
}

.categories-section h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 40px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.category-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.category-card h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary);
}

.category-card ul {
    list-style: none;
    text-align: left;
}

body.rtl .category-card ul {
    text-align: right;
}

.category-card li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 3px 0;
    position: relative;
    padding-left: 16px;
}

body.rtl .category-card li {
    padding-left: 0;
    padding-right: 16px;
}

.category-card li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

body.rtl .category-card li::before {
    left: auto;
    right: 0;
    content: '‹';
}

.category-note {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* Category accent colors */
.category-card.passport { border-top: 3px solid #4ecdc4; }
.category-card.emirates { border-top: 3px solid #ffd93d; }
.category-card.boarding { border-top: 3px solid #6c5ce7; }
.category-card.notary { border-top: 3px solid #ff6b6b; }
.category-card.others { border-top: 3px solid #718096; }

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 64px - 60px);
}

.main-content h1 {
    font-size: 32px;
    margin-bottom: 30px;
}

/* ========================================
   Upload / Dropzone
   ======================================== */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 20px;
    background: var(--bg-card);
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(0, 180, 216, 0.05);
}

.dropzone-content svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.dropzone-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dropzone-formats {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.file-input {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    color: var(--primary);
}

.file-info svg {
    flex-shrink: 0;
}

.file-info span {
    flex: 1;
    font-size: 14px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(238, 242, 247, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-right: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    color: var(--text-secondary);
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Results
   ======================================== */
.results-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.result-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.result-file-info svg {
    color: var(--primary);
}

.result-category {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.badge-passport { background: #4ecdc4; }
.badge-emirates { background: #ffd93d; color: #333; }
.badge-boarding { background: #6c5ce7; }
.badge-notary { background: #ff6b6b; }
.badge-others { background: #718096; }

.result-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.result-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.result-table-wrapper h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.result-preview-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.result-preview-wrapper h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.result-preview {
    text-align: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    padding: 12px;
}

.result-preview img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th,
.result-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

body.rtl .result-table th,
body.rtl .result-table td {
    text-align: right;
}

.result-table th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.04);
}

.result-table td {
    font-size: 14px;
}

.field-name {
    color: var(--primary);
    font-weight: 600;
}

.field-value {
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 20px;
}

/* ========================================
   Profile
   ======================================== */
.profile-card {
    max-width: 600px;
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

.profile-section h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.profile-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.language-options {
    display: flex;
    gap: 16px;
}

.language-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.language-option:hover {
    border-color: var(--primary);
}

.language-option.selected {
    border-color: var(--primary);
    background: rgba(0, 150, 199, 0.08);
}

.language-name {
    font-size: 15px;
    font-weight: 600;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.profile-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-value {
    font-weight: 600;
    font-size: 14px;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: 20px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .nav-links {
        gap: 4px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .hero h1 {
        font-size: 28px;
    }

    .language-options {
        flex-direction: column;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-content-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        justify-content: center;
    }

    .login-card {
        padding: 32px 24px;
    }
}

