/* ═══════════════════════════════════════════════
   Anemos Yachts Preventivi v1.0
   Modern Design System — No Sidebar
   Inspired by: anemosyachts.it + Notion/Linear SaaS
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --navy: #0f1d2f;
    --navy-light: #162a42;
    --navy-medium: #1a3352;
    --gold: #c9a84c;
    --gold-light: #dbc06e;
    --gold-dark: #a88a35;
    --gold-bg: rgba(201,168,76,0.06);
    --ocean: #1e3a5f;
    --sky: #4a90c4;
    --bg: #f7f8fa;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e8eaed;
    --border-hover: #d1d5db;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --transition: all 0.15s ease;
}

[data-theme="dark"] {
    --bg: #0a0f1a;
    --bg-card: #111827;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-hover: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 13.5px; font-weight: 400; color: var(--text);
    background: var(--bg); line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600; letter-spacing: -0.02em; line-height: 1.2;
}
a { color: var(--gold-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold); }

/* ── Top Navigation ─────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 100; height: 60px;
    background: var(--navy);
    display: flex; align-items: center; padding: 0 24px; gap: 0;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    margin-right: 32px; flex-shrink: 0;
}
.topbar-brand-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex; align-items: center; justify-content: center;
    color: var(--navy); font-size: 14px;
}
.topbar-brand h1 {
    font-family: 'Cormorant Garamond', serif; font-size: 1.15rem;
    font-weight: 700; color: #fff; margin: 0; white-space: nowrap;
}

.topbar-nav {
    display: flex; gap: 2px; align-items: center; height: 100%; flex: 1;
}
.topbar-nav a {
    display: flex; align-items: center; gap: 6px; padding: 0 14px;
    height: 100%; color: rgba(255,255,255,0.55); font-size: 0.8rem;
    font-weight: 500; border-bottom: 2px solid transparent;
    transition: var(--transition); white-space: nowrap;
}
.topbar-nav a:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.04); }
.topbar-nav a.active {
    color: var(--gold); border-bottom-color: var(--gold);
    background: rgba(201,168,76,0.06);
}
.topbar-nav a svg { width: 16px; height: 16px; }

.topbar-end {
    display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.topbar-user {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    border-radius: 8px; color: rgba(255,255,255,0.7); font-size: 0.78rem;
    transition: var(--transition); cursor: default;
}
.topbar-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.72rem;
}
.topbar-btn {
    background: none; border: 1px solid rgba(255,255,255,0.12);
    border-radius: 7px; color: rgba(255,255,255,0.5); cursor: pointer;
    padding: 6px 8px; transition: var(--transition);
}
.topbar-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ── Mobile hamburger ───────────────────────────── */
.mobile-toggle { display: none; background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; padding: 6px; }
.mobile-menu { display: none; }

/* ── Page Content ───────────────────────────────── */
.page-wrap { max-width: 1280px; margin: 0 auto; padding: 28px 32px; min-height: calc(100vh - 60px); }

/* ── Cards ──────────────────────────────────────── */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ── Page Header ────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
    font-size: 1.65rem; color: var(--text); display: flex; align-items: center; gap: 10px;
}
.page-header h1 svg { color: var(--gold); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 0.78rem;
    font-weight: 600; border: 1px solid transparent; cursor: pointer;
    transition: var(--transition); text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy); border-color: var(--gold-dark);
}
.btn-primary:hover { box-shadow: 0 2px 8px rgba(201,168,76,0.3); transform: translateY(-1px); color: var(--navy); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: var(--bg-card); border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dark); background: var(--gold-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.72rem; border-radius: 6px; }
.btn-lg { padding: 11px 24px; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px;
}
.form-control {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-family: 'Inter'; font-size: 0.82rem;
    color: var(--text); background: var(--bg-card); transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.1); }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
textarea.form-control { resize: vertical; min-height: 64px; }

/* ── Tables ─────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: left; padding: 10px 16px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table tbody td {
    padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.8rem;
    vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--gold-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Status Badges ──────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
    border-radius: 6px; font-size: 0.66rem; font-weight: 600; white-space: nowrap;
    letter-spacing: 0.02em;
}
.badge-bozza { background: #f1f5f9; color: #64748b; }
.badge-inviato { background: #dbeafe; color: #1d4ed8; }
.badge-accettato { background: #dcfce7; color: #15803d; }
.badge-acconto_richiesto { background: #fef3c7; color: #92400e; }
.badge-acconto_ricevuto { background: #ede9fe; color: #6d28d9; }
.badge-pagamento_inviato { background: #e0f2fe; color: #0369a1; }
.badge-pagato { background: #d1fae5; color: #065f46; }
.badge-confermato { background: #dbeafe; color: #1e40af; }
.badge-concluso { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-rifiutato { background: #fee2e2; color: #991b1b; }
.badge-scaduto { background: #f3f4f6; color: #6b7280; }

/* ── KPI Cards ──────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { padding: 18px 20px; }
.kpi-value { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1; }
.kpi-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
[data-theme="dark"] .kpi-value { color: var(--gold); }

/* ── Yacht / Tour Cards Grid ────────────────────── */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.catalog-card {
    overflow: hidden; cursor: pointer; position: relative;
}
.catalog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.catalog-card-img {
    width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: center 30%; display: block;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.catalog-card-body { padding: 14px 16px; }
.catalog-card-body h4 { font-size: 1rem; margin-bottom: 4px; color: var(--text); font-family: 'Cormorant Garamond', serif; }
.catalog-card-body p { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-card-meta { display: flex; gap: 12px; margin-top: 8px; font-size: 0.68rem; color: var(--text-secondary); }
.catalog-card-meta span { display: flex; align-items: center; gap: 3px; }

/* ── Flash Messages ─────────────────────────────── */
.flash {
    padding: 11px 16px; border-radius: 8px; margin-bottom: 16px;
    font-size: 0.8rem; font-weight: 500; display: flex; align-items: center; gap: 8px;
    animation: flashIn 0.25s ease;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Login Page ─────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--navy);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(30,58,95,0.5), transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.08), transparent 40%);
}
.login-card {
    background: rgba(255,255,255,0.04); backdrop-filter: blur(24px);
    border: 1px solid rgba(201,168,76,0.12); border-radius: var(--radius-xl);
    padding: 44px 38px; width: 400px; max-width: 92vw;
    box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.login-card h1 { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; color: #fff; text-align: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; color: var(--gold); font-size: 0.72rem; margin-bottom: 28px; opacity: 0.6; letter-spacing: 0.1em; text-transform: uppercase; }
.login-card .form-control { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); color: #fff; padding: 11px 14px; }
.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }
.login-card .form-control:focus { border-color: var(--gold); background: rgba(255,255,255,0.1); }
.login-card .form-label { color: rgba(255,255,255,0.4); }
.login-card .btn-primary { width: 100%; padding: 12px; font-size: 0.82rem; margin-top: 6px; }
.login-error { background: rgba(220,38,38,0.12); color: #fca5a5; padding: 10px 14px; border-radius: 8px; font-size: 0.78rem; margin-bottom: 14px; text-align: center; }

/* ── Bottom Nav (Mobile) ────────────────────────── */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 900; background: var(--bg-card); border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); padding: 4px 0 env(safe-area-inset-bottom); }
.bottom-nav-items { display: flex; justify-content: space-around; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 10px; font-size: 0.58rem; color: var(--text-muted); text-decoration: none; transition: var(--transition); font-weight: 500; }
.bottom-nav-item.active { color: var(--gold); }
.bottom-nav-item svg { width: 18px; height: 18px; }

/* ── Utilities ──────────────────────────────────── */
.text-gold { color: var(--gold) !important; }
.text-navy { color: var(--navy) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .topbar-nav { display: none; }
    .topbar-nav.open { display: flex; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--navy); padding: 8px; box-shadow: var(--shadow-lg); }
    .topbar-nav.open a { height: auto; padding: 12px 16px; border-bottom: none; border-radius: 8px; }
    .topbar-nav.open a.active { background: rgba(201,168,76,0.1); }
    .mobile-toggle { display: block; }
    .topbar-user .user-name { display: none; }
    .bottom-nav { display: block; }
    .page-wrap { padding: 16px 14px 80px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h1 { font-size: 1.3rem; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .catalog-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .catalog-grid { grid-template-columns: 1fr; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 1.5rem; }
}
