/* ============================================
   InvoicePilot Public Frontend - Modern Office
   Warm colors: terracotta, gold, cream, sand
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Warm palette */
    --terracotta:     #C44536;
    --terracotta-dark: #A3362A;
    --terracotta-light: #E87A6A;
    --gold:           #D4A352;
    --gold-light:     #F0D39A;
    --cream:          #FDF6F0;
    --sand:           #F5EDE4;
    --sand-dark:      #E8D5C4;

    /* Neutrals */
    --white:          #FFFFFF;
    --bg:             #FAF5EF;
    --card-bg:        #FFFFFF;
    --text:           #2D2D2D;
    --text-secondary: #7A6B64;
    --text-muted:     #A6958C;
    --border:         #E8D5C4;
    --border-light:   #F0E4D8;

    /* Accents */
    --green:          #3A7D5C;
    --green-light:    #E8F5EE;
    --blue:           #4A7FA5;
    --red:            #C44536;
    --red-light:      #FDF0ED;

    /* Shadows */
    --shadow-sm:      0 1px 3px rgba(45,45,45,0.06), 0 1px 2px rgba(45,45,45,0.04);
    --shadow-md:      0 4px 12px rgba(45,45,45,0.08);
    --shadow-lg:      0 8px 30px rgba(45,45,45,0.12);

    /* Radius */
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;

    /* Font */
    --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--terracotta);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--terracotta-dark);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.required { color: var(--terracotta); }

/* --- Layout --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

/* --- Alert --- */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid #F5D0C8;
}

.alert-success {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid #C5E0D2;
}

/* --- Navbar --- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 60px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    margin-right: auto;
}

.navbar-brand:hover { color: var(--terracotta); }

.navbar-links {
    display: flex;
    gap: 0.25rem;
}

.navbar-links a {
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.navbar-links a:hover {
    background: var(--sand);
    color: var(--text);
}

.navbar-links a.active {
    background: var(--cream);
    color: var(--terracotta);
    font-weight: 600;
}

.navbar-links a.nav-logout {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-greeting {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    background: var(--sand);
    border-radius: 999px;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.15s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-blue    { background: #EEF2F8; color: var(--blue); }
.stat-icon-gold    { background: #FCF5E8; color: var(--gold); }
.stat-icon-green   { background: var(--green-light); color: var(--green); }
.stat-icon-terracotta { background: var(--red-light); color: var(--terracotta); }

.stat-body {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.1);
}

.input-disabled {
    background: var(--sand) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

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

.form-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 1.5rem 0;
}

.form-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.profile-form h3 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
    text-decoration: none;
}

.btn-primary {
    background: var(--terracotta);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--terracotta-dark);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.btn-ghost {
    background: transparent;
    color: var(--terracotta);
    padding: 0.375rem 0.625rem;
}

.btn-ghost:hover {
    background: var(--red-light);
}

/* --- Table --- */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--sand);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--cream);
}

.table-compact td,
.table-compact th {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.table tfoot td {
    padding: 0.75rem 1rem;
    border-top: 2px solid var(--border);
    font-weight: 600;
    background: var(--cream);
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-warning {
    background: #FCF5E8;
    color: #8B7320;
}

.badge-success {
    background: var(--green-light);
    color: var(--green);
}

.badge-danger {
    background: var(--red-light);
    color: var(--red);
}

.badge-default {
    background: var(--sand);
    color: var(--text-muted);
}

/* --- Tabs --- */
.card-header-tabs {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 0;
    gap: 0;
}

.tab-group {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    cursor: pointer;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab-active {
    color: var(--terracotta) !important;
    border-bottom-color: var(--terracotta);
    font-weight: 600;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 0.375rem;
    padding: 1rem 1.5rem;
    justify-content: center;
}

.page-link {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.page-link:hover {
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.page-active {
    background: var(--terracotta);
    color: var(--white);
    border-color: var(--terracotta);
}

.page-active:hover {
    background: var(--terracotta-dark);
    color: var(--white);
}

/* --- Auth Pages --- */
.auth-page {
    background: linear-gradient(135deg, #FAF5EF 0%, #F5EDE4 50%, #EDDFD0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    border: 1px solid var(--border-light);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    margin-bottom: 1rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-form .form-group:last-child {
    margin-bottom: 0;
}

.auth-form .btn {
    margin-top: 1.25rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 600;
}

/* --- Invoice Detail --- */
.invoice-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem 1rem;
    font-size: 0.9rem;
}

.detail-list dt {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-list dd {
    color: var(--text);
}

.detail-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--terracotta) !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar-links {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .detail-list dt {
        margin-top: 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Badge variants (draft pipeline) --- */
.badge-info {
    background: #EAF2F8;
    color: var(--blue);
}

/* --- Timeline (draft folyamat elozmenyek) --- */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0 0.5rem 0;
}

.timeline-item {
    position: relative;
    padding: 0 0 1.25rem 1.75rem;
    border-left: 2px solid var(--border-light);
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0.25rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--terracotta);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--border-light);
}

.timeline-item:first-child::before {
    background: var(--green);
}

.timeline-event {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
}

.timeline-time {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* --- AI confidence sav --- */
.confidence {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: var(--sand);
    border-radius: 999px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--green);
    border-radius: 999px;
}

.alert-warning {
    background: #FCF5E8;
    color: #8B7320;
    border: 1px solid var(--gold-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    margin: 0 1.5rem 1.5rem;
}
