/* ============================================
   REBULDIO DESIGN SYSTEM v3 - APP
   Dashboards, auth, wizard, admin, project cards
   ============================================ */

:root {
    --app-sidebar: 280px;
    --app-surface: #FFFFFF;
    --app-stroke: var(--border-color);
}

body.app-page,
body.auth-page,
body.wizard-page,
body.admin-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(240, 100, 24, 0.06), transparent 32%),
        linear-gradient(180deg, #FBF9F6 0%, var(--gray-100) 100%);
    background-attachment: fixed;
}

.app-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.app-backdrop::before,
.app-backdrop::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    filter: blur(80px);
}

.app-backdrop::before {
    width: 22rem; height: 22rem;
    top: 6rem; left: -7rem;
    background: rgba(240, 100, 24, 0.14);
}

.app-backdrop::after {
    width: 24rem; height: 24rem;
    right: -8rem; top: 18rem;
    background: rgba(43, 47, 54, 0.08);
}

.auth-main, .app-main, .admin-main, .wizard-main { position: relative; z-index: 1; }
.header { z-index: 100; }

/* ---------- Floating app header ---------- */
.header.app-header {
    margin: 0.75rem auto 0;
    width: calc(100% - 1.5rem);
    max-width: 1320px;
    top: 0.75rem;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: visible;
}

.header.app-header .container,
.header.app-header .header-container { overflow: visible; }

@media (max-width: 480px) {
    .header.app-header { width: calc(100% - 1rem); margin-top: 0.5rem; top: 0.5rem; border-radius: var(--radius-lg); }
    .user-menu-trigger > span { display: none; }
    .user-menu-trigger { padding-right: 0.3rem; }
}

@media (max-width: 1024px) {
    .user-menu-trigger > span { display: inline; }
}

/* ---------- Panels ---------- */
.auth-hero,
.auth-card,
.app-panel,
.wizard-panel,
.admin-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-stroke);
    box-shadow: var(--shadow-md);
}

.app-panel, .wizard-panel, .admin-panel {
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 2rem);
}

/* ---------- Auth ---------- */
.auth-main { padding: clamp(1.5rem, 5vw, 3rem) 0 clamp(2.5rem, 6vw, 4rem); }

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: stretch;
}

.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    min-height: 36rem;
    padding: clamp(1.75rem, 4vw, 3rem);
    border: none;
    border-radius: var(--radius-2xl);
    background: var(--anthracite-gradient);
    color: #fff;
    box-shadow: var(--shadow-xl);
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(240, 100, 24, 0.22), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(240, 100, 24, 0.08), transparent 40%);
    pointer-events: none;
}

.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h1, .auth-hero h2, .auth-hero h3 { color: #fff; }
.auth-hero p { color: rgba(255, 255, 255, 0.78); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    max-width: 100%;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary-hover);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-hero .eyebrow { background: rgba(255, 255, 255, 0.12); color: #fff; }

.auth-title {
    font-size: clamp(2rem, 4.5vw, 3.75rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    margin: 1.25rem 0 1rem;
    overflow-wrap: break-word;
}

.auth-copy { max-width: 34rem; font-size: 1.05rem; line-height: 1.75; }

.auth-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.auth-metric {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-metric strong { display: block; font-size: 1.5rem; color: var(--primary); }
.auth-metric span { display: block; margin-top: 0.2rem; font-size: 0.85rem; color: rgba(255, 255, 255, 0.75); }

.auth-card {
    border-radius: var(--radius-2xl);
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.auth-card-header { margin-bottom: 1.5rem; }
.auth-card-header h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); margin-bottom: 0.5rem; }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-hero { min-height: auto; }
    .auth-card { order: -1; }
}

@media (max-width: 560px) {
    .auth-metrics { grid-template-columns: minmax(0, 1fr); }
    .auth-hero { display: none; }
    .auth-card { order: 0; }
}

/* ---------- App shell / dashboards ---------- */
.app-main, .admin-main { padding: clamp(1.25rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4rem); }

.app-shell, .admin-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.app-hero-card, .admin-hero-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: var(--radius-2xl);
    background: var(--anthracite-gradient);
    color: #fff;
    box-shadow: var(--shadow-xl);
    isolation: isolate;
}

.app-hero-card::before, .admin-hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 100% 0%, rgba(240, 100, 24, 0.22), transparent 45%);
    pointer-events: none;
}

.app-hero-card h1, .admin-hero-card h1 {
    font-size: clamp(1.75rem, 4vw, 3rem);
    margin-bottom: 0.5rem;
    color: #fff;
}

.app-hero-card p, .admin-hero-card p { color: rgba(255, 255, 255, 0.78); }

.app-hero-card .btn-secondary, .admin-hero-card .btn-secondary {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.app-hero-card .btn-secondary:hover, .admin-hero-card .btn-secondary:hover {
    background: #fff;
    color: var(--anthracite-900);
    border-color: #fff;
}

.app-hero-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.app-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.dashboard-stat, .app-stat-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-stat::before, .app-stat-card::before {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.dashboard-stat-value, .app-stat-value {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    line-height: 1;
    color: var(--anthracite-900);
    margin-bottom: 0.45rem;
}

.dashboard-stat-label, .app-stat-label { color: var(--text-secondary); font-size: 0.925rem; }

/* Stats inside dark hero stay readable */
.app-hero-card .dashboard-stat-value, .app-hero-card .app-stat-value { color: var(--anthracite-900); }

.app-section-card {
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 1.75rem);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.section-head h2 { margin: 0; font-size: clamp(1.25rem, 2.5vw, 1.6rem); }

/* ---------- Project cards ---------- */
.project-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: clamp(1.1rem, 3vw, 1.5rem);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

@media (hover: hover) {
    .project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
}

.project-card + .project-card { margin-top: 1rem; }

.project-card-header, .project-card-footer, .project-card-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.project-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    margin: 0.9rem 0;
}

.project-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--anthracite-600);
}

.project-card-title { font-size: clamp(1.1rem, 2.5vw, 1.25rem); margin: 0; }
.project-card-description { margin-bottom: 0; }

@media (max-width: 560px) {
    .project-card-header, .project-card-footer, .project-card-actions { flex-direction: column; align-items: stretch; }
    .project-card-actions .btn, .project-card-footer .btn { width: 100%; }
}

/* ---------- Selection cards ---------- */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.selection-card {
    position: relative;
    padding: 1.35rem;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background-color var(--transition-base);
}

.selection-card:hover { border-color: var(--primary-soft); box-shadow: var(--shadow-md); }

.selection-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 14px 36px -18px rgba(240, 100, 24, 0.55);
}

.selection-card.selected::after {
    content: 'Vybráno';
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary-gradient);
}

.selection-card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.selection-card-title { font-size: 1.1rem; font-weight: 600; color: var(--anthracite-900); margin-bottom: 0.3rem; }
.selection-card-description { font-size: 0.9rem; color: var(--text-secondary); }

@media (max-width: 640px) {
    .selection-grid { grid-template-columns: minmax(0, 1fr); }
    .selection-card.selected { padding-top: 2.6rem; }
}

/* ---------- Wizard ---------- */
.wizard-main { padding: clamp(1.25rem, 3vw, 2rem) 0 clamp(2.5rem, 6vw, 4rem); }
.wizard-container { width: min(1160px, calc(100% - 1.5rem)); margin: 0 auto; }

.wizard-progress, .wizard-content {
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.wizard-progress {
    border-radius: var(--radius-xl);
    padding: 1.1rem;
    margin-bottom: 1.25rem;
}

.wizard-progress-bar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.wizard-step {
    text-align: center;
    padding: 0.7rem 0.4rem;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.wizard-step.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
    font-weight: 600;
}

.wizard-step.completed { background: var(--success-light); border-color: rgba(16, 185, 129, 0.45); color: #047857; }

.wizard-step-number {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 0.4rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--anthracite-700);
}

.wizard-step.active .wizard-step-number { background: var(--primary-gradient); border-color: transparent; color: #fff; }
.wizard-step.completed .wizard-step-number { background: var(--success); border-color: transparent; color: #fff; }
.wizard-step-label { display: block; line-height: 1.25; }
.wizard-step-content { display: block; }

.wizard-content { border-radius: var(--radius-xl); padding: clamp(1.25rem, 3.5vw, 2.25rem); }
.wizard-title { font-size: clamp(1.6rem, 3.5vw, 2.5rem); margin-bottom: 0.6rem; }
.wizard-subtitle { margin-bottom: 1.5rem; }

.wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    /* Keep all 7 steps in one swipeable row instead of a tall list */
    .wizard-progress-bar {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.4rem;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .wizard-step { flex: 0 0 auto; min-width: 5.5rem; scroll-snap-align: center; }
}

@media (max-width: 560px) {
    .wizard-step-label { display: none; }
    .wizard-step { min-width: 3.4rem; padding: 0.5rem 0.3rem; }
    .wizard-step-number { margin-bottom: 0; }
    .wizard-navigation { flex-direction: column-reverse; align-items: stretch; }
    .wizard-navigation .btn { width: 100%; }
}

/* ---------- Admin ---------- */
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Tablet tuning ---------- */
@media (max-width: 900px) {
    .app-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .app-stats-grid { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
    .app-hero-row { flex-direction: column; align-items: stretch; }
    .app-hero-actions { flex-direction: column; width: 100%; }
    .app-hero-actions .btn { width: 100%; }
    .section-head { flex-direction: column; align-items: flex-start; }
}
