/* ============================================================
   VIAGO - Core CSS
   Všetky farby idú cez CSS premenné z BrandService::renderCssVars()
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--brand-text);
    background: var(--brand-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.5;
    /* Anti-overflow safety: zabrániť horizontálnemu scrollu na celom webe */
    overflow-x: hidden;
    max-width: 100%;
}

/* Bezpečnostná sieť pre obrázky a media - vždy fit do parent containera */
img, video, iframe, svg, table { max-width: 100%; }
table { word-break: break-word; }

/* Long words / URLs - zabrániť aby pretliacli mobile viewport */
p, h1, h2, h3, h4, h5, h6, li, td, th, div, span, a {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a {
    color: var(--brand-primary-dark);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover { color: var(--brand-primary); }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .5em;
    font-weight: 700;
    color: var(--brand-text);
    letter-spacing: -0.01em;
}

img { max-width: 100%; height: auto; display: block; }

button { font-family: inherit; cursor: pointer; }

/* Helper layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-weight: 600;
    font-size: 15px;
    border: 1px solid transparent;
    border-radius: var(--brand-radius);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--brand-button);
    color: var(--brand-secondary);
    box-shadow: 0 4px 14px rgba(255, 201, 60, .35);
}
.btn-primary:hover {
    background: var(--brand-primary-dark);
    color: var(--brand-secondary);
}

.btn-secondary {
    background: var(--brand-secondary);
    color: #fff;
}
.btn-secondary:hover { opacity: .9; }

.btn-outline {
    background: transparent;
    border-color: var(--brand-primary);
    color: var(--brand-secondary);
}
.btn-outline:hover {
    background: var(--brand-primary-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--brand-text-muted);
    border-color: #e5e7eb;
}
.btn-ghost:hover {
    color: var(--brand-text);
    background: #f9fafb;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    background: #f3f4f6;
    color: var(--brand-text);
    border: none;
}
.btn-icon:hover { background: #e5e7eb; }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--brand-text);
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--brand-text);
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--brand-radius);
    transition: border-color .15s ease, box-shadow .15s ease;
    outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-soft);
}
.form-input::placeholder { color: #9ca3af; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-help {
    font-size: 12px;
    color: var(--brand-text-muted);
    margin-top: 4px;
}
.form-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

input[type="color"].form-color {
    width: 64px;
    height: 44px;
    padding: 4px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
}

input[type="file"].form-file {
    width: 100%;
    padding: 10px;
    border: 1.5px dashed #d1d5db;
    border-radius: var(--brand-radius);
    background: #fafafa;
    font-size: 14px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: #fff;
    border-radius: calc(var(--brand-radius) + 4px);
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
    padding: 22px;
    border: 1px solid #f1f5f9;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.card-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--brand-radius);
    overflow: hidden;
}
.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.table th {
    background: #fafafa;
    font-weight: 600;
    color: var(--brand-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
}
.table tbody tr:hover { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: 0; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-success { background: #ecfdf5; color: #047857; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-neutral { background: #f3f4f6; color: #374151; }
.badge-brand   { background: var(--brand-primary-soft); color: var(--brand-secondary); }

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--brand-radius);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    animation: slideIn .3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #78350f; border-color: #fde68a; }

/* ============================================================
   UTIL
   ============================================================ */
.text-muted { color: var(--brand-text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-bold { font-weight: 700; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* Loader */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   NATIVE APP MODE (iOS/Android WebView)
   Aktivuje sa keď body má class "native-app"
   ============================================================ */

/* Safe area insets pre notch/Dynamic Island/home indicator */
body.native-app {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* iOS – disable text size adjust pri rotácii */
body.native-ios {
    -webkit-text-size-adjust: 100%;
}

/* Skryť všetky webové prvky v native app móde */
body.native-app .public-header,
body.native-app .public-footer,
body.native-app .public-nav,
body.native-app .cookie-banner,
body.native-app .web-only,
body.native-app .app-download-section,
body.native-app .download-cta,
body.native-app .install-app-cta,
body.native-app .app-banner {
    display: none !important;
}

/* Disable pull-to-refresh ktoré by mohlo konfliktovať s app gestures */
body.native-app {
    overscroll-behavior-y: contain;
}

/* Disable text selection na UI elementoch (button, nav, header)
   ako natívna appka – ale ponechať na inputoch a obsahových oblastiach */
body.native-app button,
body.native-app .app-header,
body.native-app .app-bottom-nav,
body.native-app nav {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
