/* ========================================
   iOS Design System - Travel Agency App
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* iOS Color System */
    --ios-primary: #007AFF;
    --ios-primary-dark: #0051D5;
    --ios-secondary: #8A8A8E;
    --ios-background: #F9F9F9;
    --ios-card: #FFFFFF;
    --ios-text-primary: #000000;
    --ios-text-secondary: #8A8A8E;
    --ios-border: #E5E5EA;
    --ios-success: #34C759;
    --ios-danger: #FF3B30;
    --ios-warning: #FF9500;
    
    /* Spacing System */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--ios-background);
    color: var(--ios-text-primary);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 88px; /* Space for bottom nav */
}

/* ========================================
   App Layout Structure
   ======================================== */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--ios-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid var(--ios-border);
    z-index: 1000;
    padding: 8px var(--spacing-md);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-text-primary);
    text-align: center;
    margin: 0;
    letter-spacing: -0.3px;
}

.app-content {
    margin-top: 60px;
    padding: var(--spacing-lg) var(--spacing-md);
    padding-bottom: calc(88px + var(--spacing-lg));
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Bottom Navigation
   ======================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ios-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 0.5px solid var(--ios-border);
    height: 88px;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-decoration: none;
    color: var(--ios-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    min-height: 60px;
}

.bottom-nav-item:active {
    transform: scale(0.95);
    opacity: 0.7;
}

.bottom-nav-item.active {
    color: var(--ios-primary);
}

.bottom-nav-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bottom-nav-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.bottom-nav-item.active .bottom-nav-label {
    font-weight: 600;
}

/* ========================================
   Typography
   ======================================== */

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--ios-text-primary);
    margin-bottom: var(--spacing-lg);
    letter-spacing: -0.4px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-text-primary);
    margin-bottom: var(--spacing-md);
    padding: 0 var(--spacing-sm);
    letter-spacing: -0.3px;
}

.text-primary {
    font-size: 16px;
    font-weight: 400;
    color: var(--ios-text-primary);
    line-height: 1.5;
}

.text-secondary {
    font-size: 14px;
    font-weight: 400;
    color: var(--ios-text-secondary);
    line-height: 1.5;
}

.text-small {
    font-size: 12px;
    font-weight: 400;
    color: var(--ios-text-secondary);
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--ios-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--ios-border);
}

.card-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 0.5px solid var(--ios-border);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ios-text-primary);
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--ios-text-secondary);
}

/* ========================================
   Forms
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ios-text-primary);
    margin-bottom: var(--spacing-xs);
    padding: 0 var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--ios-card);
    border: 0.5px solid var(--ios-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 400;
    color: var(--ios-text-primary);
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--ios-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%238A8A8E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-right: var(--spacing-md);
    padding-left: 40px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    min-height: 50px;
    width: 100%;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.1px;
}

.btn:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.btn-primary {
    background: var(--ios-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--ios-primary-dark);
}

.btn-secondary {
    background: var(--ios-border);
    color: var(--ios-text-primary);
}

.btn-success {
    background: var(--ios-success);
    color: white;
}

.btn-danger {
    background: var(--ios-danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--ios-primary);
    color: var(--ios-primary);
}

/* ========================================
   Tables
   ======================================== */

.table-container {
    background: var(--ios-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--ios-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--ios-background);
}

.table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 0.5px solid var(--ios-border);
}

.table td {
    padding: var(--spacing-md);
    text-align: right;
    font-size: 15px;
    color: var(--ios-text-primary);
    border-bottom: 0.5px solid var(--ios-border);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:active {
    background: var(--ios-background);
}

/* ========================================
   Dashboard Cards
   ======================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.dashboard-card {
    background: var(--ios-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--ios-border);
    text-align: center;
}

.dashboard-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--ios-text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-card-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--ios-text-primary);
    letter-spacing: -0.5px;
}

.dashboard-card-value.positive {
    color: var(--ios-success);
}

.dashboard-card-value.negative {
    color: var(--ios-danger);
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    font-size: 15px;
    border: 0.5px solid;
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    border-color: var(--ios-success);
    color: var(--ios-success);
}

.alert-error {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--ios-danger);
    color: var(--ios-danger);
}

/* ========================================
   List Items
   ======================================== */

.list-item {
    background: var(--ios-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--ios-border);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.list-item:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.list-item-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--ios-text-primary);
}

.list-item-subtitle {
    font-size: 14px;
    color: var(--ios-text-secondary);
}

.list-item-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-text-primary);
}

.list-item-value.positive {
    color: var(--ios-success);
}

.list-item-value.negative {
    color: var(--ios-danger);
}

.profit-positive {
    color: var(--ios-success);
    font-weight: 600;
}

.profit-negative {
    color: var(--ios-danger);
    font-weight: 600;
}

/* ========================================
   Filters
   ======================================== */

.filter-section {
    background: var(--ios-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 0.5px solid var(--ios-border);
}

.filter-row {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 120px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ios-text-secondary);
    margin-bottom: var(--spacing-xs);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--ios-background);
    border: 0.5px solid var(--ios-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
}

/* ========================================
   Utilities
   ======================================== */

.no-data {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--ios-text-secondary);
    font-size: 15px;
}

.text-center {
    text-align: center;
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 480px) {
    .app-content {
        padding: var(--spacing-md);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ========================================
   Safe Area Support
   ======================================== */

@supports (padding: max(0px)) {
    .app-content {
        padding-left: max(var(--spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--spacing-md), env(safe-area-inset-right));
    }
    
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}
