/* Portal Styles - Simplified version for clients */

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a { color: var(--primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 24px; margin-bottom: 5px; }
.login-header p { color: var(--text-muted); }

.login-form .form-group { margin-bottom: 20px; }

/* Portal Layout */
.portal-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.portal-header h1 {
    font-size: 18px;
    color: var(--text-color);
}

.portal-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-content {
    flex: 1;
    padding: 24px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Shared components */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.form-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s;
    text-decoration: none; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-outline:hover { background: var(--bg-color); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
table th { background: #f9fafb; font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; }
table tbody tr:hover { background: #f9fafb; }

.badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #e5e7eb; color: #4b5563; }
.badge-info { background: #dbeafe; color: #1e40af; }

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-3 { margin-top: 16px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 18px; color: var(--text-color); margin-bottom: 8px; }

/* Invoice view within portal - A4 proportions */
.invoice-document { background: white; width: 210mm; min-height: 297mm; padding: 20mm 20mm 30mm 20mm; margin: 0 auto; box-shadow: var(--shadow-lg); border-radius: var(--radius); font-size: 12px; line-height: 1.5; position: relative; }
.invoice-logo { text-align: center; height: 30mm; display: flex; align-items: flex-start; justify-content: center; }
.invoice-logo img { max-width: 180px; max-height: 20mm; }
.invoice-qr-code { position: absolute; top: 53mm; right: 20mm; text-align: center; width: 25mm; }
.invoice-qr-code img { width: 25mm; height: 25mm; display: block; }
.invoice-qr-code span { display: block; font-size: 6pt; color: #6b7280; margin-top: 2px; line-height: 1.3; }
.invoice-sender-line { font-size: 6pt; color: #6b7280; max-width: 45%; margin-bottom: 3px; margin-left: 2mm; line-height: 1.3; white-space: nowrap; }
.invoice-client-address { margin-bottom: 40px; margin-left: 2mm; font-size: 13px; line-height: 1.7; max-width: 50%; }
.invoice-title-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 30px; }
.invoice-title-number { font-size: 16px; font-weight: 600; color: var(--text-color); }
.invoice-title-date { font-size: 13px; color: var(--text-color); }
.invoice-items-section { margin-bottom: 10px; }
.invoice-items-section table th { background-color: transparent; color: var(--text-color); text-transform: none; font-size: 12px; font-weight: 600; border-bottom: 2px solid var(--text-color); border-top: 1px solid var(--text-color); padding: 8px 10px; }
.invoice-items-section table td { padding: 10px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; font-size: 12px; }
.invoice-totals { display: flex; justify-content: flex-end; margin-bottom: 30px; }
.invoice-totals table { width: 300px; }
.invoice-totals table td { padding: 6px 12px; border: none; font-size: 12px; }
.invoice-totals table tr:last-child { font-weight: 700; font-size: 14px; border-top: 2px solid var(--text-color); }
.invoice-payment-terms { margin-bottom: 20px; font-size: 12px; font-style: italic; }
.invoice-closing { margin-bottom: 20px; font-size: 12px; line-height: 1.8; }
.invoice-notes { margin-bottom: 20px; font-size: 12px; color: var(--text-muted); }
.invoice-page-footer { position: absolute; bottom: 15mm; left: 20mm; right: 20mm; display: grid; grid-template-columns: auto auto auto auto; justify-content: space-between; gap: 0; font-size: 6.5pt; color: #6b7280; border-top: 1px solid #d1d5db; padding-top: 8px; line-height: 1.5; }

@media print {
    .portal-header, .btn, .no-print { display: none !important; }
    .portal-content { padding: 0; max-width: none; }
    .invoice-document { box-shadow: none; border-radius: 0; width: 100%; min-height: auto; padding: 0; margin: 0; }
    .invoice-page-footer { position: relative; bottom: auto; left: auto; right: auto; margin-top: 40px; }
    body { background: white; }
    @page { size: A4; margin: 15mm; }
}

@media (max-width: 768px) {
    .invoice-page-footer { grid-template-columns: 1fr 1fr; }
}
