/* =========================================
   Bootstrap 5 Clean Responsive Style
   Bilingual Activity Registration System
   ========================================= */

:root {
    --bs-primary: #0d6efd;
    --bs-primary-rgb: 13, 110, 253;
    --app-bg: #f5f7fa;
    --app-surface: #ffffff;
    --app-text: #212529;
    --app-muted: #6c757d;
    --app-border: #e9ecef;
    --app-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06);
    --app-shadow-hover: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--app-bg);
    color: var(--app-text);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

body.rtl { direction: rtl; text-align: right; }
body.ltr { direction: ltr; text-align: left; }

/* ================== Navbar ================== */
.app-navbar {
    background-color: #fff;
    border-bottom: 1px solid var(--app-border);
    padding: 0.75rem 0;
}

.app-navbar .navbar-brand {
    font-weight: 700;
    color: var(--app-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-navbar .navbar-brand i {
    color: var(--bs-primary);
}

/* ================== Cards ================== */
.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    box-shadow: var(--app-shadow);
    overflow: hidden;
}

.app-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    background: #fff;
}

.app-card-header h1,
.app-card-header h2,
.app-card-header h3,
.app-card-header h5 {
    margin: 0;
    font-weight: 600;
}

.app-card-body {
    padding: 1.5rem;
}

/* ================== Hero (registration) ================== */
.hero-card-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
    padding: 2rem 1.5rem;
    text-align: center;
    border: 0;
}

.hero-card-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-card-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

/* ================== Stat Cards ================== */
.stat-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card:hover {
    box-shadow: var(--app-shadow-hover);
    transform: translateY(-2px);
}

.stat-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.stat-icon.bg-primary  { background-color: #0d6efd; }
.stat-icon.bg-success  { background-color: #198754; }
.stat-icon.bg-warning  { background-color: #fd7e14; }
.stat-icon.bg-info     { background-color: #0dcaf0; }
.stat-icon.bg-purple   { background-color: #6f42c1; }
.stat-icon.bg-dark     { background-color: #343a40; }

.stat-info { flex: 1; min-width: 0; }

.stat-label {
    font-size: 0.78rem;
    color: var(--app-muted);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1;
    color: var(--app-text);
}

/* ================== Forms ================== */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--app-text);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #ced4da;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
}

body.rtl .form-control,
body.rtl .form-select { text-align: right; }

body.rtl .form-select {
    background-position: left 0.75rem center;
    padding-right: 0.85rem;
    padding-left: 2.25rem;
}

/* ================== Buttons ================== */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-icon {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    line-height: 1;
}

/* ================== Tabs (Custom Pills) ================== */
.app-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-bottom: 1px solid var(--app-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.app-tab-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--app-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}

.app-tab-btn:hover {
    background-color: #f8f9fa;
    color: var(--app-text);
}

.app-tab-btn.active {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.tab-content { display: none; }
.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

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

/* ================== Tables ================== */
.table {
    color: var(--app-text);
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--app-border);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td { border-bottom: 0; }

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

.table-responsive {
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

/* ================== Inline edit fields in tables ================== */
.table .form-control-sm,
.table .form-select-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 0.375rem;
}

/* ================== Login Page ================== */
.login-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.login-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(13,110,253,0.3);
}

/* ================== Lang switcher ================== */
.lang-switcher {
    display: inline-flex;
    background-color: #f1f3f5;
    border-radius: 0.5rem;
    padding: 0.2rem;
}

.lang-btn {
    border: 0;
    background: transparent;
    padding: 0.3rem 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--app-muted);
    transition: all 0.15s;
    font-family: inherit;
}

.lang-btn.active {
    background-color: #0d6efd;
    color: #fff;
}

.lang-btn:hover:not(.active) {
    color: var(--app-text);
}

/* ================== User chip ================== */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #e7f1ff;
    color: #0d6efd;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ================== Success Screen ================== */
.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #198754;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin: 0 auto 1.25rem;
    animation: pop 0.4s ease-out;
}

@keyframes pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ================== Empty State ================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--app-muted);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 0.75rem;
}

.empty-state p { margin: 0; font-size: 0.95rem; }

/* ================== Spinner ================== */
.app-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* ================== Toast ================== */
.toast-container-app {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    min-width: 280px;
    max-width: 90vw;
}

/* ================== Phone link ================== */
.phone-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.phone-link:hover { text-decoration: underline; }

/* ================== Subform area (compact gray block) ================== */
.subform {
    background-color: #f8f9fa;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.subform h6 {
    font-weight: 600;
    margin-bottom: 0.85rem;
    color: var(--app-text);
}

/* ================== Helpers ================== */
.hidden { display: none !important; }

.text-mono code {
    font-size: 0.8rem;
    color: #d63384;
    background: #fff5f7;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
}

/* ================== Responsive tweaks ================== */
@media (max-width: 575.98px) {
    .app-card-body { padding: 1rem; }
    .hero-card-header { padding: 1.5rem 1rem; }
    .hero-card-header h1 { font-size: 1.2rem; }
    .stat-value { font-size: 1.35rem; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.05rem; }
    .stat-card { padding: 0.85rem; gap: 0.75rem; }
    .app-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .app-tab-btn { white-space: nowrap; }
    .table thead th, .table tbody td {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 767.98px) {
    .navbar-actions {
        gap: 0.4rem !important;
    }
    .navbar-actions .btn { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
    .user-chip { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
}
