/* CSS Variables - TechTools Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-hover: #232338;
    --border-color: #2a2a40;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-hover: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

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

/* Custom Scrollbar - Dark Theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-right {
    justify-content: flex-end;
}

.header-center {
    flex: 2;
    text-align: center;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.header h1 i {
    color: var(--accent-primary);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
}

.back-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-icon.btn-download:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-icon.btn-delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard View */
.dashboard-header {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

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

/* Invoice List */
.invoice-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    min-height: 200px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.invoice-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.invoice-item:last-child {
    border-bottom: none;
}

.invoice-item:hover {
    background: var(--bg-hover);
}

.invoice-number {
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 120px;
}

.invoice-customer {
    flex: 1;
    color: var(--text-primary);
}

.invoice-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    min-width: 100px;
}

.invoice-amount {
    font-weight: 600;
    min-width: 120px;
    text-align: right;
}

.invoice-status {
    min-width: 100px;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.draft {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}

.status-badge.issued {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.paid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.invoice-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

/* Customers Section */
.customers-section {
    margin-top: 2rem;
}

.customers-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.customers-section h2 i {
    color: var(--accent-primary);
}

.customers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.customer-card:hover {
    border-color: var(--accent-primary);
}

.customer-card-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.customer-card-ico {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Editor View */
.editor-view {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.editor-header h2 {
    flex: 1;
    font-size: 1.25rem;
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

.editor-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.editor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.editor-card h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.editor-card h3 i {
    color: var(--accent-primary);
}

.editor-card textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

.editor-card textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.editor-card textarea::placeholder {
    color: var(--text-muted);
}

/* Form Elements */
.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1rem;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

/* Dark theme for select dropdowns */
.form-group select,
.customer-select select,
.item-row select {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-group select option,
.customer-select select option,
.item-row select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.form-group select option:hover,
.customer-select select option:hover,
.item-row select option:hover,
.form-group select option:checked,
.customer-select select option:checked,
.item-row select option:checked {
    background-color: var(--accent-primary);
    color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* Date input styling */
.form-group input[type="date"] {
    background: var(--bg-primary);
    color: var(--text-primary);
    color-scheme: dark;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

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

.form-group-sm {
    max-width: 120px;
}

.input-with-btn {
    display: flex;
    gap: 0.5rem;
}

.input-with-btn input {
    flex: 1;
}

.input-with-btn .btn-icon {
    flex-shrink: 0;
}

.input-hint {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.input-hint.valid {
    color: var(--success);
}

.input-hint.invalid {
    color: var(--danger);
}

/* Customer Select */
.customer-select {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.customer-select select {
    flex: 1;
    padding: 0.625rem 2rem 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.customer-select select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.customer-preview {
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 80px;
}

.customer-preview.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Items Table */
.items-card {
    grid-column: 1 / -1;
}

.items-table {
    margin-bottom: 1rem;
}

.items-header {
    display: grid;
    grid-template-columns: 1fr 80px 80px 100px 100px 40px;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.items-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px 100px 100px 40px;
    gap: 0.75rem;
    align-items: center;
}

.item-row input,
.item-row select {
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.item-row input:focus,
.item-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.item-total {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.item-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Totals Card */
.totals-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: none;
}

.total-row.grand-total span:last-child {
    color: var(--accent-primary);
}

.total-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    margin-bottom: 1rem;
}

/* Logo Upload */
.logo-upload {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.logo-preview {
    width: 150px;
    height: 100px;
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.logo-preview:hover {
    border-color: var(--accent-primary);
}

.logo-preview i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.logo-preview span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.modal-lg {
    max-width: 700px;
}

.modal-preview {
    max-width: 900px;
    max-height: 95vh;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.modal-preview .modal-header {
    flex-shrink: 0;
}

.modal-preview .modal-body {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    color: var(--accent-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

/* Modal scrollbar - slightly more visible */
.modal-body::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.preview-actions {
    display: flex;
    gap: 0.75rem;
    margin-right: auto;
    margin-left: 1rem;
}

/* Invoice Preview */
.preview-body {
    background: #f5f5f5;
    padding: 2rem;
}

.invoice-preview {
    background: white;
    color: #1a1a1a;
    padding: 2rem;
    max-width: 210mm;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    line-height: 1.5;
}

.invoice-preview .invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e5e5;
}

.invoice-preview .header-logo {
    flex: 1;
}

.invoice-preview .supplier-logo {
    max-width: 150px;
    max-height: 70px;
}

.invoice-preview .invoice-title {
    text-align: right;
}

.invoice-preview .invoice-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.invoice-preview .invoice-number-display {
    font-size: 14px;
    font-weight: 600;
}

.invoice-preview .parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-preview .party h3 {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.invoice-preview .party-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 0.25rem;
}

.invoice-preview .dates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 4px;
}

.invoice-preview .date-item label {
    font-size: 10px;
    color: #666;
    display: block;
}

.invoice-preview .date-item span {
    font-weight: 600;
}

.invoice-preview .items-table-preview {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.invoice-preview .items-table-preview th {
    background: #6366f1;
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
}

.invoice-preview .items-table-preview th:last-child {
    text-align: right;
}

.invoice-preview .items-table-preview td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e5e5;
}

.invoice-preview .items-table-preview td:last-child {
    text-align: right;
    font-weight: 600;
}

.invoice-preview .totals-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.invoice-preview .totals-box {
    min-width: 250px;
}

.invoice-preview .total-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.invoice-preview .total-line.grand {
    font-size: 16px;
    font-weight: 700;
    border-top: 2px solid #1a1a1a;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.invoice-preview .total-line.grand span:last-child {
    color: #6366f1;
}

.invoice-preview .no-vat-note {
    font-size: 11px;
    color: #666;
    text-align: right;
    margin-top: 0.5rem;
}

.invoice-preview .payment-section {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.invoice-preview .payment-info h3 {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.invoice-preview .payment-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.invoice-preview .payment-row label {
    color: #666;
    min-width: 100px;
}

.invoice-preview .payment-row span {
    font-weight: 500;
}

.invoice-preview .qr-code {
    width: 100px;
    height: 100px;
}

.invoice-preview .qr-code canvas {
    width: 100% !important;
    height: 100% !important;
}

.invoice-preview .notes-section {
    margin-bottom: 1.5rem;
}

.invoice-preview .notes-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.invoice-preview .footer {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e5;
}

.invoice-preview .signature {
    text-align: center;
}

.invoice-preview .signature-line {
    width: 150px;
    border-top: 1px solid #1a1a1a;
    margin: 2rem auto 0.5rem;
}

.invoice-preview .signature span {
    font-size: 10px;
    color: #666;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    z-index: 2000;
}

.toast.hidden {
    display: none;
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Utility */
.hidden {
    display: none !important;
}

/* SEO Content Section */
.seo-content {
    max-width: 900px;
    margin: 3rem auto 2rem;
    padding: 0 1.5rem;
}

/* SEO Hero */
.seo-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.seo-hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.seo-hero h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.seo-hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* SEO Feature Cards */
.seo-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.seo-feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition);
}

.seo-feature-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.seo-feature-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.75rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.seo-feature-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.seo-feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* SEO Expandable Details */
.seo-details {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.seo-details summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    list-style: none;
}

.seo-details summary::-webkit-details-marker {
    display: none;
}

.seo-details summary:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.seo-details summary i:first-child {
    color: var(--accent-primary);
}

.seo-details summary span {
    flex: 1;
}

.seo-details-arrow {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.seo-details[open] .seo-details-arrow {
    transform: rotate(180deg);
}

.seo-details[open] summary {
    border-bottom: 1px solid var(--border-color);
}

/* SEO Article (inside details) */
.seo-article {
    padding: 1.5rem;
}

.seo-article h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.seo-article h3::before {
    content: '';
    width: 3px;
    height: 1rem;
    background: var(--accent-primary);
    border-radius: 2px;
}

.seo-article h3:first-child {
    margin-top: 0;
}

.seo-article p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.seo-article strong {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 900px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

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

    .items-header,
    .item-row {
        grid-template-columns: 1fr 60px 60px 80px 80px 32px;
        font-size: 0.8rem;
    }

    .seo-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .back-btn span {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .editor-header {
        flex-wrap: wrap;
    }

    .editor-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .invoice-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .invoice-number {
        min-width: auto;
    }

    .invoice-customer {
        width: 100%;
        order: -1;
    }

    .items-header {
        display: none;
    }

    .item-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
        background: var(--bg-primary);
        border-radius: var(--radius-sm);
    }

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

    .preview-body {
        padding: 0.5rem;
    }

    .invoice-preview {
        padding: 1rem;
        font-size: 10px;
    }

    .seo-content {
        margin: 2rem auto;
        padding: 0 1rem;
    }

    .seo-hero h2 {
        font-size: 1.35rem;
    }

    .seo-hero-subtitle {
        font-size: 0.9rem;
    }

    .seo-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .seo-feature-card {
        padding: 1rem;
    }

    .seo-feature-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .seo-feature-card h3 {
        font-size: 0.85rem;
    }

    .seo-feature-card p {
        font-size: 0.75rem;
    }

    .seo-details summary {
        font-size: 0.85rem;
        padding: 0.875rem 1rem;
    }

    .seo-article {
        padding: 1.25rem;
    }

    .seo-article h3 {
        font-size: 0.9rem;
    }

    .seo-article p {
        font-size: 0.85rem;
    }
}

/* Print Styles */
@media print {
    /* Reset everything */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide everything */
    body > *:not(#previewModal) {
        display: none !important;
    }

    .app-container,
    .header,
    .main-content,
    .seo-content,
    .toast,
    #setupModal,
    #customerModal,
    .modal-overlay,
    .modal-header,
    .modal-close {
        display: none !important;
    }

    /* Show and style the preview modal */
    #previewModal {
        display: block !important;
        position: static !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    #previewModal .modal-content {
        position: static !important;
        max-width: none !important;
        max-height: none !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        transform: none !important;
    }

    #previewModal .modal-body {
        padding: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        background: white !important;
    }

    #previewModal .preview-body {
        padding: 0 !important;
        background: white !important;
    }

    #previewModal .invoice-preview {
        box-shadow: none !important;
        max-width: none !important;
        width: 100% !important;
        padding: 15mm !important;
        margin: 0 !important;
        background: white !important;
    }

    /* Page setup */
    @page {
        margin: 0;
        size: A4;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Table handling */
    thead {
        display: table-header-group;
    }

    tr {
        page-break-inside: avoid;
    }
}

/* =========================================
   AUTH UI STYLES
   ========================================= */

/* Auth UI in Header */
.auth-ui {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.auth-guest, .auth-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-user.hidden, .auth-guest.hidden {
    display: none;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Auth Modal */
.modal-auth {
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.auth-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.hidden {
    display: none;
}

.btn-fast-register {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-fast-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.form-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-error {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 0.85rem;
}

.auth-error.hidden {
    display: none;
}

.btn-block {
    width: 100%;
}

.auth-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-info i {
    color: var(--accent-primary);
}

/* Sync indicator banner */
.sync-banner {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sync-banner i {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

.sync-banner a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.sync-banner a:hover {
    text-decoration: underline;
}

/* Mobile auth UI */
@media (max-width: 480px) {
    .auth-ui .btn-sm span {
        display: none;
    }

    .user-name {
        display: none;
    }

    .auth-tabs {
        flex-direction: column;
    }
}
