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

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #4a4a4a;
    --accent-color: #d4af37;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    overflow: hidden;
}

.header-content {
    padding: 30px;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 80px;
    height: 80px;
    background: var(--accent-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    flex-shrink: 0;
}

.company-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.company-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    opacity: 0.9;
}

.company-contact span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Section Styles */
.section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    padding: 24px 24px 0;
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    margin-bottom: 16px;
}

/* Form Styles */
.client-form {
    padding: 0 24px 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: var(--accent-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #c4962a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #3a3a3a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 8px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Table Styles */
.table-container {
    padding: 0 24px 24px;
    overflow-x: auto;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.items-table th {
    background: var(--primary-color);
    color: white;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.items-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.items-table tr:hover {
    background-color: #f9fafb;
}

.items-table input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s ease;
}

.items-table input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

.items-table .description-input {
    min-width: 200px;
}

.items-table .number-input {
    width: 80px;
    text-align: center;
}

.items-table .currency-input {
    width: 120px;
    text-align: right;
}

.items-table .area-display,
.items-table .total-display {
    font-weight: 600;
    color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 24px;
}

/* Totals Section */
.totals-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.totals-container {
    padding: 24px;
}

.totals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
}

.totals-row:last-child {
    margin-bottom: 0;
}

.total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.discount-item {
    grid-column: 1;
}

.final-total {
    grid-column: 2;
    background: var(--primary-color);
    color: white;
}

.total-label {
    font-weight: 500;
    font-size: 14px;
}

.total-value {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
}

.final-value {
    color: var(--accent-color);
    font-size: 24px;
}

.discount-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.discount-input input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
}

.discount-percent {
    font-weight: 600;
    color: var(--text-primary);
}

/* Observations Section */
.observations-section {
    padding: 0 24px 24px;
}

/* Actions Section */
.actions-section {
    background: var(--card-background);
}

.actions-container {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.actions-right {
    display: flex;
    gap: 16px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 12px;
}

.footer-content p {
    margin-bottom: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content {
        padding: 20px;
    }
    
    .company-info {
        flex-direction: column;
        text-align: center;
    }
    
    .company-contact {
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .items-table {
        font-size: 12px;
    }
    
    .items-table th,
    .items-table td {
        padding: 12px 8px;
    }
    
    .items-table .description-input {
        min-width: 150px;
    }
    
    .totals-row {
        grid-template-columns: 1fr;
    }
    
    .discount-item {
        grid-column: 1;
    }
    
    .final-total {
        grid-column: 1;
    }
    
    .actions-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .actions-right {
        width: 100%;
        justify-content: stretch;
    }
    
    .actions-right .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .company-name {
        font-size: 24px;
    }
    
    .company-contact {
        flex-direction: column;
        gap: 8px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .total-value {
        font-size: 16px;
    }
    
    .final-value {
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .header,
    .section,
    .footer {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .actions-section {
        display: none;
    }
    
    .btn {
        display: none;
    }
    
    .items-table th {
        background: #f0f0f0 !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus Styles for Accessibility */
.btn:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}