:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --bg-app: #f1f5f9;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 900px;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: var(--primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: #eff6ff;
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    padding: 5px 10px;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Paper / Quote Sheet */
.paper {
    background: var(--surface);
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-height: 1000px;
    /* A4 aspectish */
}

/* Form Styles */
input,
textarea {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    background: #f8fafc;
    transition: 0.2s;
}

input:hover,
textarea:hover {
    background: #f1f5f9;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

textarea {
    resize: vertical;
    width: 100%;
    min-height: 40px;
}

/* Quote Header */
.quote-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 20px;
}

.company-info {
    flex: 1;
}

.company-info h2 {
    color: var(--primary-dark);
    margin-bottom: 5px;
}

.company-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.quote-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.meta-row label {
    font-weight: 700;
    color: var(--text-light);
    font-size: 0.8rem;
}

.meta-row input {
    width: 140px;
    text-align: right;
}

/* Client Section */
.client-section {
    margin-bottom: 30px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
}

.client-section h3 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 1px;
}

.client-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.client-form .row {
    display: flex;
    gap: 10px;
}

.client-form input {
    flex: 1;
}

.full-width {
    width: 100%;
}

/* Items Table */
.items-section table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.items-section th {
    text-align: left;
    padding: 10px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.items-section th:first-child {
    border-top-left-radius: 6px;
}

.items-section th:last-child {
    border-top-right-radius: 6px;
}

.items-section td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.col-save {
    width: 5%;
    text-align: center;
}

.col-desc {
    width: 35%;
}

.col-qty {
    width: 10%;
}

.col-price {
    width: 20%;
}

.col-total {
    width: 20%;
    text-align: right;
    font-weight: 600;
}

.col-action {
    width: 10%;
    text-align: center;
}

.item-desc-input {
    width: 100%;
}

.qty-input,
.price-input {
    width: 100%;
    text-align: right;
}

.add-row-container {
    text-align: center;
    margin-bottom: 40px;
}

/* Totals Section */
.totals-section {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-top: 20px;
}

.notes-area {
    flex: 1;
}

.notes-area h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.calculations {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.calc-row.total {
    border-top: 2px solid var(--text-main);
    margin-top: 10px;
    padding-top: 15px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.footer-msg {
    margin-top: 60px;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .app-container {
        max-width: 100%;
    }

    .no-print {
        display: none !important;
    }

    .paper {
        box-shadow: none;
        padding: 0;
    }

    input {
        border: none;
        background: transparent;
        padding: 0;
    }

    textarea {
        border: none;
        resize: none;
        background: transparent;
    }

    .client-section {
        background: transparent;
        border: 1px solid var(--border);
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.client-list {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.client-item {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.client-item:hover {
    background-color: #f1f5f9;
}

.client-item-info strong {
    display: block;
    color: var(--primary-dark);
}

.client-item-info small {
    color: var(--text-light);
}

.client-actions button {
    margin-left: 5px;
    padding: 5px 8px;
    font-size: 0.8rem;
}