/**
 * Camera Studio App - iOS Native Black & White Theme
 * Minimalist design with white background and black accents
 */

/* ============================================
   GLOBAL ANTI-BLINK FIX - MUST BE FIRST
   Completely disables tap highlights on iOS/Android WebView
   ============================================ */

/* UNIVERSAL TAP HIGHLIGHT DISABLE */
* {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    tap-highlight-color: transparent !important;
    outline: none !important;
}

/* Disable ALL touch callouts */
html, body, div, span, section, article, aside, header, footer, main, nav,
.card, .modal, .overlay, .content, .container {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* Allow text selection only in inputs/textareas */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* ============================================
   PREVENT ALL BACKGROUND FLASH ON TOUCH
   Using !important with fixed colors, NOT inherit
   ============================================ */

/* Body - always gray background */
body {
    background-color: #f5f5f5 !important;
}
body:active, body:focus, body:hover {
    background-color: #f5f5f5 !important;
}

/* Cards - always white background */
.card,
.card:active,
.card:focus,
.card:hover,
.card:focus-within,
[class*="card"],
[class*="card"]:active,
[class*="card"]:focus,
[class*="card"]:hover {
    background-color: #ffffff !important;
}

/* Card inner elements - just disable tap highlight, don't change backgrounds */
.card * {
    -webkit-tap-highlight-color: transparent !important;
}

/* But keep card-footer gray */
.card-footer, .card-footer:active, .card-footer:focus {
    background-color: #fafafa !important;
}

/* Generic divs and containers - no background change */
div:not(.btn):not(button):not(.card):not([class*="card"]),
div:not(.btn):not(button):not(.card):not([class*="card"]):active,
div:not(.btn):not(button):not(.card):not([class*="card"]):focus {
    -webkit-tap-highlight-color: transparent !important;
}

/* Sections and other containers */
section, article, aside, header, footer, main, nav,
section:active, section:focus,
article:active, article:focus,
header:active, header:focus,
footer:active, footer:focus,
main:active, main:focus,
nav:active, nav:focus {
    -webkit-tap-highlight-color: transparent !important;
}

/* Overlays and Modals - keep their rgba backgrounds */
[id*="Overlay"], [class*="overlay"],
[id*="Modal"], [class*="modal"],
.lightbox, [class*="lightbox"] {
    -webkit-tap-highlight-color: transparent !important;
}

[id*="Overlay"]:active, [id*="Overlay"]:focus,
[class*="overlay"]:active, [class*="overlay"]:focus,
[id*="Modal"]:active, [id*="Modal"]:focus,
[class*="modal"]:active, [class*="modal"]:focus {
    -webkit-tap-highlight-color: transparent !important;
}

/* CSS Custom Properties - iOS Black & White */
:root {
    /* Colors - Pure Black & White */
    --color-primary: #000000;
    --color-secondary: #000000;
    --color-accent: #000000;
    
    /* Neutrals - Grayscale only */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-50: #fafafa;
    --color-gray-100: #f5f5f5;
    --color-gray-200: #e5e5e5;
    --color-gray-300: #d4d4d4;
    --color-gray-400: #a3a3a3;
    --color-gray-500: #737373;
    --color-gray-600: #525252;
    --color-gray-700: #404040;
    --color-gray-800: #262626;
    --color-gray-900: #171717;
    
    /* Semantic Colors - Minimal */
    --color-success: #000000;
    --color-error: #000000;
    --color-warning: #525252;
    --color-info: #000000;
    
    /* Typography - iOS System Font */
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Spacing (8px grid) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* Border Radius - iOS Style */
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows - Minimal iOS style */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px 0 rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 24px 0 rgba(0, 0, 0, 0.15);
    
    /* Transitions - iOS smooth */
    --transition-fast: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-base: 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
    
    /* Z-index layers */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 1000;
    --z-modal: 1001;
    --z-popover: 600;
    --z-tooltip: 9999;
}

/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Remove blue tap highlights on Android/iOS */
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    -webkit-touch-callout: none;
}

/* Allow text selection in input fields and text areas */
input, textarea, [contenteditable], select {
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* Remove focus outlines */
*:focus {
    outline: none !important;
}

/* Remove tap highlight but preserve background colors on click */
* {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
}

/* Only remove background on active for buttons and links, not containers */
button:active,
a:active,
.btn:active {
    opacity: 0.7 !important;
}

/* Prevent blinking/flashing on modals, overlays, and toolbars */
.modal,
.modal-overlay,
.lightbox,
.lightbox-overlay,
[class*="overlay"],
[class*="modal"],
[class*="lightbox"],
[class*="toolbar"],
[class*="Toolbar"],
[id*="Overlay"],
[id*="Modal"],
[id*="Lightbox"],
[id*="Toolbar"],
[id*="toolbar"] {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* Already handled by global anti-blink rules above */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--color-black);
    background-color: var(--color-white);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    color: var(--color-black);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: var(--space-4); }

a {
    color: var(--color-black);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.7;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Layout Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

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

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-normal { font-weight: var(--font-weight-regular); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Color Utilities */
.text-black { color: var(--color-black); }
.text-gray-400 { color: var(--color-gray-400); }
.text-gray-500 { color: var(--color-gray-500); }
.text-gray-600 { color: var(--color-gray-600); }
.text-gray-700 { color: var(--color-gray-700); }

.bg-white { background-color: var(--color-white); }
.bg-black { background-color: var(--color-black); }
.bg-gray-50 { background-color: var(--color-gray-50); }
.bg-gray-100 { background-color: var(--color-gray-100); }

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-20 { margin-bottom: 5rem; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Display Utilities */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Section */
.section {
    padding: var(--space-16) 0;
}

.section-header {
    margin-bottom: var(--space-8);
}

/* Divider */
.divider {
    height: 1px;
    background-color: var(--color-gray-200);
    margin: var(--space-6) 0;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
}

.loading-text {
    margin-top: var(--space-4);
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
}

.empty-title {
    font-size: 1.25rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-black);
    margin-bottom: var(--space-2);
}

.empty-message {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fadeIn {
    animation: fadeIn var(--transition-base);
}

.animate-slideUp {
    animation: slideUp var(--transition-base);
}

/* Responsive */
@media (max-width: 768px) {
    html { font-size: 14px; }
    .container { padding: 0 var(--space-3); }
    .section { padding: var(--space-10) 0; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}
