@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&display=swap');

:root {
    /* Colors - Premium Blue Palette */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #6366f1;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Layout Variables */
    --tab-bar-height: 70px;
    --header-height: 60px;
    --safe-area: 16px;
    --radius: 18px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

[data-theme="dark"] {
    --bg-body: #020617;
    --bg-card: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.6;
    font-size: 16px;
    padding-bottom: calc(var(--tab-bar-height) + 20px);
    overflow-x: hidden;
    user-select: none;
    /* Mobile app feel */
}

/* --- App Header --- */
.app-header {
    height: var(--header-height);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--safe-area);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    color: var(--primary);
    font-size: 1.2rem;
}

.logo-section i {
    font-size: 1.8rem;
}

/* --- Tab Bar Navigation --- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    gap: 4px;
    transition: 0.2s;
}

.tab-link i {
    font-size: 1.6rem;
}

.tab-link.active {
    color: var(--primary);
}

/* --- Containers --- */
.container {
    padding: var(--safe-area);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1rem;
}

.stat-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 900;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- List Items --- */
.item-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 2px;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 1rem;
}

.label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 700;
}

.input {
    width: 100%;
    height: 54px;
    background: var(--bg-body);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 0 16px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    transition: 0.2s;
}

.input:focus {
    border-color: var(--primary);
}

/* --- Buttons --- */
.btn {
    width: 100%;
    height: 54px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

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

.btn-primary:active {
    transform: scale(0.97);
    background: var(--primary-dark);
}

/* --- Badges --- */
.badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
}

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

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

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

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}