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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* Navbar */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.5rem;
    color: #5533aa;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-email {
    color: #666;
    font-size: 0.9rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 1rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #5533aa;
    color: white;
}

.btn-primary:hover {
    background-color: #4422aa;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1.05rem;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-box h1 {
    color: #5533aa;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-box .subtitle {
    color: #666;
    margin-bottom: 2rem;
}

.google-login-btn {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.google-login-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.google-login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #666;
    text-align: left;
}

/* Search Bar */
.search-bar {
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: #5533aa;
}

/* Invoices List */
.invoices-list {
    display: grid;
    gap: 1.5rem;
}

.invoice-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.invoice-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

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

.invoice-header h3 {
    font-size: 1.3rem;
    color: #333;
}

.invoice-status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-draft {
    background: #ffc107;
    color: #000;
}

.status-finalized {
    background: #28a745;
    color: white;
}

.status-sent {
    background: #17a2b8;
    color: white;
}

.invoice-details {
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.detail-row .label {
    color: #666;
    font-weight: 500;
}

.detail-row .value {
    color: #333;
    font-weight: 600;
}

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

/* Forms */
.invoice-form {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-section {
    margin-bottom: 2.5rem;
}

.form-section h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #5533aa;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #5533aa;
}

/* Product Search */
.product-search {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.product-search input {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.product-search input:focus {
    outline: none;
    border-color: #5533aa;
}

/* Products List */
.products-list {
    margin-bottom: 1.5rem;
}

.product-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.product-info h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.3rem;
}

.product-info p {
    font-size: 0.85rem;
    color: #666;
}

.product-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.product-controls label {
    font-weight: 500;
    font-size: 0.9rem;
}

.quantity-input,
.price-input {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.line-total {
    font-weight: bold;
    color: #5533aa;
    font-size: 1.1rem;
    min-width: 80px;
}

/* Total Section */
.total-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    text-align: right;
}

.total-section h4 {
    font-size: 1.5rem;
    color: #333;
}

.total-section span {
    color: #5533aa;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.error {
    text-align: center;
    padding: 2rem 1rem;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-actions .btn {
        width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .product-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .quantity-input,
    .price-input {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

