/**
 * Baladi Employee Tracker - iOS Design System Base
 * Native iOS Productivity App Experience
 * Supports: English, Thai, Arabic (RTL)
 */

/* ========================================
   iOS DESIGN SYSTEM VARIABLES
   ======================================== */

:root {
    /* iOS System Colors */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-orange: #FF9500;
    --ios-red: #FF3B30;
    --ios-teal: #5AC8FA;
    --ios-purple: #AF52DE;
    --ios-pink: #FF2D55;
    --ios-indigo: #5856D6;
    
    /* iOS Gray Scale */
    --ios-gray-1: #8E8E93;
    --ios-gray-2: #AEAEB2;
    --ios-gray-3: #C7C7CC;
    --ios-gray-4: #D1D1D6;
    --ios-gray-5: #E5E5EA;
    --ios-gray-6: #F2F2F7;
    
    /* Semantic Colors */
    --ios-label: #000000;
    --ios-label-secondary: #3C3C43;
    --ios-label-tertiary: #3C3C4399;
    --ios-label-quaternary: #3C3C434D;
    
    /* Backgrounds */
    --ios-bg-primary: #F2F2F7;
    --ios-bg-secondary: #FFFFFF;
    --ios-bg-tertiary: #F2F2F7;
    --ios-bg-grouped: #F2F2F7;
    --ios-bg-grouped-secondary: #FFFFFF;
    
    /* Status Colors */
    --status-pending: #FF9500;
    --status-completed: #34C759;
    --status-overdue: #FF3B30;
    --status-active: #007AFF;
    
    /* Shadows */
    --ios-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --ios-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --ios-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --ios-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    
    /* Border Radius */
    --ios-radius-sm: 8px;
    --ios-radius-md: 12px;
    --ios-radius-lg: 16px;
    --ios-radius-xl: 20px;
    --ios-radius-2xl: 24px;
    --ios-radius-full: 9999px;
    
    /* Spacing */
    --ios-space-xs: 4px;
    --ios-space-sm: 8px;
    --ios-space-md: 12px;
    --ios-space-lg: 16px;
    --ios-space-xl: 20px;
    --ios-space-2xl: 24px;
    --ios-space-3xl: 32px;
    
    /* Typography */
    --ios-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    --ios-font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    
    /* Font Sizes */
    --ios-text-xs: 11px;
    --ios-text-sm: 13px;
    --ios-text-base: 15px;
    --ios-text-md: 17px;
    --ios-text-lg: 20px;
    --ios-text-xl: 22px;
    --ios-text-2xl: 28px;
    --ios-text-3xl: 34px;
    --ios-text-timer: 48px;
    --ios-text-timer-lg: 64px;
    
    /* Font Weights */
    --ios-font-regular: 400;
    --ios-font-medium: 500;
    --ios-font-semibold: 600;
    --ios-font-bold: 700;
    --ios-font-heavy: 800;
    
    /* Transitions */
    --ios-transition-fast: 0.15s ease;
    --ios-transition-normal: 0.25s ease;
    --ios-transition-slow: 0.35s ease;
    --ios-spring: cubic-bezier(0.25, 0.1, 0.25, 1);
    
    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-loading: 9999;
}

/* ========================================
   CSS RESET FOR PLUGIN CONTAINERS
   ======================================== */

/* Box-sizing reset */
.bet-portal *,
.bet-portal *::before,
.bet-portal *::after,
.bet-dashboard *,
.bet-dashboard *::before,
.bet-dashboard *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base container styles */
.bet-portal,
.bet-dashboard {
    font-family: var(--ios-font-family);
    font-size: var(--ios-text-md);
    line-height: 1.47059;
    color: var(--ios-label);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
}

/* Typography reset */
.bet-portal h1,
.bet-portal h2,
.bet-portal h3,
.bet-portal h4,
.bet-portal h5,
.bet-portal h6,
.bet-dashboard h1,
.bet-dashboard h2,
.bet-dashboard h3,
.bet-dashboard h4,
.bet-dashboard h5,
.bet-dashboard h6 {
    font-family: inherit;
    font-weight: var(--ios-font-bold);
    line-height: 1.2;
    margin: 0;
    padding: 0;
    color: var(--ios-label);
}

.bet-portal p,
.bet-dashboard p {
    margin: 0;
    padding: 0;
}

/* Reset links */
.bet-portal a,
.bet-dashboard a {
    color: var(--ios-blue);
    text-decoration: none;
    transition: opacity var(--ios-transition-fast);
}

.bet-portal a:active,
.bet-dashboard a:active {
    opacity: 0.7;
}

/* Reset lists */
.bet-portal ul,
.bet-portal ol,
.bet-dashboard ul,
.bet-dashboard ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Reset buttons */
.bet-portal button,
.bet-dashboard button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Active state for buttons - iOS tap feedback */
.bet-portal button:active,
.bet-dashboard button:active {
    opacity: 0.7;
}

.bet-portal button:disabled,
.bet-dashboard button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Reset inputs */
.bet-portal input,
.bet-portal select,
.bet-portal textarea,
.bet-dashboard input,
.bet-dashboard select,
.bet-dashboard textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

.bet-portal input:focus,
.bet-portal select:focus,
.bet-portal textarea:focus,
.bet-dashboard input:focus,
.bet-dashboard select:focus,
.bet-dashboard textarea:focus {
    outline: none;
}

/* Reset images */
.bet-portal img,
.bet-dashboard img {
    max-width: 100%;
    height: auto;
    display: block;
    border: none;
}

/* Reset tables */
.bet-portal table,
.bet-dashboard table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text utilities */
.bet-text-primary { color: var(--ios-label) !important; }
.bet-text-secondary { color: var(--ios-label-secondary) !important; }
.bet-text-tertiary { color: var(--ios-label-tertiary) !important; }
.bet-text-blue { color: var(--ios-blue) !important; }
.bet-text-green { color: var(--ios-green) !important; }
.bet-text-orange { color: var(--ios-orange) !important; }
.bet-text-red { color: var(--ios-red) !important; }

/* Background utilities */
.bet-bg-primary { background-color: var(--ios-bg-primary) !important; }
.bet-bg-secondary { background-color: var(--ios-bg-secondary) !important; }
.bet-bg-grouped { background-color: var(--ios-bg-grouped) !important; }

/* Monospace font for timers/numbers */
.bet-mono {
    font-family: var(--ios-font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Center content */
.bet-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Visually hidden but accessible */
.bet-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   RTL SUPPORT (Arabic)
   ======================================== */

/* RTL Direction */
[dir="rtl"] .bet-portal,
[dir="rtl"] .bet-dashboard {
    direction: rtl;
    text-align: right;
}

/* Flip flex for RTL */
[dir="rtl"] .bet-portal .bet-flex-row,
[dir="rtl"] .bet-dashboard .bet-flex-row {
    flex-direction: row-reverse;
}

/* Keep LTR for numbers and PINs */
[dir="rtl"] .bet-portal .bet-pin-input,
[dir="rtl"] .bet-portal .bet-mono,
[dir="rtl"] .bet-dashboard .bet-mono {
    direction: ltr;
    text-align: center;
}

/* Logical properties for spacing (auto-flips in RTL) */
.bet-ms-auto { margin-inline-start: auto; }
.bet-me-auto { margin-inline-end: auto; }
.bet-ps-md { padding-inline-start: var(--ios-space-md); }
.bet-pe-md { padding-inline-end: var(--ios-space-md); }

/* ========================================
   iOS ANIMATIONS
   ======================================== */

@keyframes ios-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ios-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ios-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ios-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ios-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes ios-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* ========================================
   WORDPRESS THEME OVERRIDE
   ======================================== */

/* Disable WordPress theme styles that might interfere */
.bet-portal .entry-content,
.bet-portal .post-content,
.bet-portal article,
.bet-dashboard .entry-content,
.bet-dashboard .post-content,
.bet-dashboard article {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Full width container */
.bet-portal-wrapper,
.bet-dashboard-wrapper {
    width: 100%;
    min-height: 100vh;
}

/* Hide theme elements on plugin pages */
.bet-portal-page .site-header,
.bet-portal-page .site-footer,
.bet-portal-page .entry-header,
.bet-portal-page .entry-footer,
.bet-dashboard-page .site-header,
.bet-dashboard-page .site-footer,
.bet-dashboard-page .entry-header,
.bet-dashboard-page .entry-footer {
    display: none;
}

/* ========================================
   COMPONENT BASE STYLES
   ======================================== */

/* iOS Inset Grouped Card */
.bet-card {
    background: var(--ios-bg-grouped-secondary);
    border-radius: var(--ios-radius-xl);
    padding: var(--ios-space-lg);
    box-shadow: var(--ios-shadow-card);
}

/* iOS List Row */
.bet-list-row {
    background: var(--ios-bg-secondary);
    padding: var(--ios-space-md) var(--ios-space-lg);
    border-bottom: 0.5px solid var(--ios-gray-4);
    display: flex;
    align-items: center;
    gap: var(--ios-space-md);
    min-height: 44px;
}

.bet-list-row:first-child {
    border-radius: var(--ios-radius-xl) var(--ios-radius-xl) 0 0;
}

.bet-list-row:last-child {
    border-radius: 0 0 var(--ios-radius-xl) var(--ios-radius-xl);
    border-bottom: none;
}

.bet-list-row:only-child {
    border-radius: var(--ios-radius-xl);
    border-bottom: none;
}

/* iOS Circular Checkbox */
.bet-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--ios-gray-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--ios-transition-fast);
}

.bet-checkbox.checked {
    background: var(--ios-blue);
    border-color: var(--ios-blue);
}

.bet-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* iOS Segmented Control */
.bet-segmented-control {
    display: inline-flex;
    background: var(--ios-gray-5);
    border-radius: var(--ios-radius-sm);
    padding: 2px;
    gap: 2px;
}

.bet-segment {
    padding: var(--ios-space-sm) var(--ios-space-lg);
    border-radius: calc(var(--ios-radius-sm) - 2px);
    font-size: var(--ios-text-sm);
    font-weight: var(--ios-font-semibold);
    color: var(--ios-label);
    background: transparent;
    transition: all var(--ios-transition-fast);
}

.bet-segment.active {
    background: var(--ios-bg-secondary);
    box-shadow: var(--ios-shadow-sm);
}

.bet-segment:active:not(.active) {
    opacity: 0.7;
}

/* iOS Button Base */
.bet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ios-space-sm);
    padding: var(--ios-space-md) var(--ios-space-xl);
    border-radius: var(--ios-radius-lg);
    font-size: var(--ios-text-md);
    font-weight: var(--ios-font-semibold);
    transition: all var(--ios-transition-fast);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.bet-btn:active {
    opacity: 0.7;
    transform: scale(0.98);
}

.bet-btn-primary {
    background: var(--ios-blue);
    color: white;
}

.bet-btn-success {
    background: var(--ios-green);
    color: white;
}

.bet-btn-danger {
    background: var(--ios-red);
    color: white;
}

.bet-btn-secondary {
    background: var(--ios-gray-5);
    color: var(--ios-label);
}

.bet-btn-ghost {
    background: transparent;
    color: var(--ios-blue);
}

/* Large action button (for Check In/Out) */
.bet-btn-lg {
    min-height: 56px;
    padding: var(--ios-space-lg) var(--ios-space-2xl);
    font-size: var(--ios-text-lg);
    font-weight: var(--ios-font-bold);
    border-radius: var(--ios-radius-2xl);
    box-shadow: var(--ios-shadow-md);
}

/* Circular/Pill button */
.bet-btn-pill {
    border-radius: var(--ios-radius-full);
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.bet-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--ios-gray-4);
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: ios-spin 0.8s linear infinite;
}

.bet-spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .bet-portal,
    .bet-dashboard {
        background: white !important;
    }
    
    .bet-btn,
    .bet-modal,
    .bet-loading {
        display: none !important;
    }
}
