:root {
    --primary: #c62828;
    --primary-dark: #8e0000;
    --accent: #fff5f5;
    --text-dark: #2d2e32;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: #f3f4f6;
    margin: 0;
    padding: 12px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
}

.form-container { max-width: 500px; margin: auto; animation: fadeIn 0.5s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Header Architecture */
.main-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 30px 20px;
    border-radius: var(--radius) var(--radius) 20px 20px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(198, 40, 40, 0.2);
}

.logo { width: 50px; height: auto; position: relative; z-index: 2; margin-bottom: 10px; }
.main-header h1 { font-size: 20px; margin: 0; position: relative; z-index: 2; }
.en-sub-header { font-size: 10px; letter-spacing: 2px; opacity: 0.8; margin-top: 4px; }

/* Cards Styling */
.card {
    background: white;
    margin-top: 15px;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: 0.3s;
}

.card:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.05); }

.info-card { border-top: 6px solid var(--primary); }
.title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.en-label { font-size: 12px; color: var(--text-light); text-transform: uppercase; }

.label-heading { font-weight: 700; font-size: 15px; display: block; margin-bottom: 15px; }

/* Branch Selector Grid */
.branch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.branch-grid input { display: none; }
.branch-tile {
    border: 2px solid var(--border);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.branch-grid input:checked + .branch-tile {
    border-color: var(--primary);
    background: var(--accent);
    color: var(--primary);
}

/* Modern Input Field */
.modern-input {
    display: flex;
    align-items: center;
    background: #f9fafb;
    padding: 12px 15px;
    border-radius: 8px;
}
.modern-input i { color: var(--text-light); margin-left: 12px; width: 18px; }
.modern-input input { border: none; background: transparent; width: 100%; font-size: 16px; outline: none; }

/* Check Tiles */
.check-group { display: grid; gap: 10px; }
.check-tile {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}
.check-tile input { margin-left: 15px; width: 20px; height: 20px; accent-color: var(--primary); }
.check-content { display: flex; flex-direction: column; }
.check-content small { color: var(--text-light); }

/* Camera UI */
.camera-trigger {
    border: 2px dashed #d1d5db;
    padding: 30px;
    text-align: center;
    border-radius: 15px;
    cursor: pointer;
    background: #fcfcfc;
    display: block;
}
.icon-circle {
    width: 60px; height: 60px; background: var(--accent); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 15px;
}
.icon-circle i { color: var(--primary); width: 30px; height: 30px; }

.preview-frame { position: relative; border-radius: 15px; overflow: hidden; }
#imagePreview { width: 100%; display: block; }
.remove-overlay {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 15px;
    background: rgba(0,0,0,0.6); color: white; border: none; cursor: pointer;
    backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Footer Actions */
.actions { margin-top: 30px; padding-bottom: 40px; }
.submit-btn {
    width: 100%; padding: 20px; background: var(--primary); color: white;
    border: none; border-radius: 15px; font-size: 18px; font-weight: 700;
    cursor: pointer; box-shadow: 0 8px 20px rgba(198, 40, 40, 0.3);
    transition: 0.3s; position: relative;
}
.submit-btn:active { transform: scale(0.97); }
.hidden { display: none; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: white; padding: 30px; border-radius: 20px; width: 90%; max-width: 400px;
    text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.modal-loader {
    width: 40px; height: 40px; border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary); border-radius: 50%;
    margin: 20px auto; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.modal-btn {
    margin-top: 20px; padding: 12px 30px; background: var(--primary);
    color: white; border: none; border-radius: 10px; font-weight: 700; cursor: pointer;
}
.success-icon { color: #4caf50; width: 60px; height: 60px; margin-bottom: 15px; }
.error-icon { color: #f44336; width: 60px; height: 60px; margin-bottom: 15px; }
.hidden { display: none !important; }

.custom-select {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: 0.3s;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent);
}

.custom-select:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Developer Footer Styling */
.developer-footer {
    margin-top: 40px;
    padding: 20px;
    display: flex;
    justify-content: center;
    padding-bottom: 40px;
}

.dev-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.dev-card:hover {
    transform: translateY(-5px);
}

.dev-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.dev-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--primary);
}

.project-name {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.dev-text {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.6;
}

.brand-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
}

.client-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 50px;
    padding: 4px 12px;
    border: 1px solid #eee;
}

.version-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #999;
    margin-left: 6px;
    font-weight: bold;
}

.version-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}

.dev-icon, .client-icon {
    width: 18px;
    height: 18px;
}

/* تنسيقات شبكة التقارير */
.reports-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
    padding-bottom: 20px;
}

.report-card {
    background: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.report-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(198, 40, 40, 0.1);
}

.report-card-icon {
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
}

.report-card-icon i {
    width: 28px;
    height: 28px;
}

.report-card-body {
    flex-grow: 1;
}

.report-card-body h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-dark);
}

.report-card-body p {
    margin: 2px 0 8px;
    font-size: 12px;
    color: var(--text-light);
}

.report-tag {
    font-size: 10px;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: var(--primary-dark);
}

.report-card-arrow {
    color: var(--border);
    transition: 0.3s;
}

.report-card:hover .report-card-arrow {
    color: var(--primary);
    transform: translateX(-5px);
}

/* Back Navigation */
.back-nav { max-width: 500px; margin: 10px auto; padding: 0 5px; }
.back-btn {
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    color: var(--text-light); font-size: 0.9rem; padding: 8px 12px;
    border-radius: var(--radius); transition: all 0.3s ease;
    background: white; border: 1px solid var(--border);
}
.back-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--accent); transform: translateX(-5px); }

/* تنسيق زر تحديث النظام */
.header-actions-top {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background: white;
    color: var(--primary);
    transform: rotate(180deg);
}

.refresh-btn i {
    width: 18px;
    height: 18px;
}