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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f1e 100%);
    color: #e5e7eb;
    min-height: 100vh;
}

/* App Layout */
.app-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    min-height: 100vh;
}

/* Input Panel */
.input-panel {
    background: rgba(31, 31, 31, 0.95);
    border-right: 1px solid #374151;
    padding: 2rem;
    overflow-y: auto;
    max-height: 100vh;
}

.input-panel::-webkit-scrollbar {
    width: 8px;
}

.input-panel::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.input-panel::-webkit-scrollbar-thumb {
    background: #f39c12;
    border-radius: 4px;
}

.panel-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f39c12;
    margin-bottom: 2rem;
    text-align: center;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #374151;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #f39c12;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #374151;
    border-radius: 8px;
    color: #e5e7eb;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
}

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

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

.btn-small {
    padding: 0.75rem 1rem;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-small:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

/* Item Rows */
.item-row {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #374151;
    margin-bottom: 0.75rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.item-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f39c12;
}

.btn-remove {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.item-inputs {
    display: grid;
    gap: 0.75rem;
}

.item-inputs .input-group {
    margin-bottom: 0;
}

.item-row-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Buttons */
.btn-add {
    width: 100%;
    padding: 0.75rem;
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid #f39c12;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-add:hover {
    background: #f39c12;
    color: white;
}

.action-buttons {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #f39c12;
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.btn-primary:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    border: 1px solid #374151;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Preview Container */
.preview-container {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.invoice-page {
    width: 595pt;
    min-height: 842pt;
    margin: 20pt auto;
}

/* Invoice Styles (User's Template) */
.page-content {
    min-height: 802pt;
    display: flex;
    flex-direction: column;
    padding: 40pt;
    border: 1px solid #374151;
    background-color: rgb(28, 28, 28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-radius: 24pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #e5e7eb;
}

.header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40pt;
}

.seller-info p {
    margin: 0;
    line-height: 1.6;
    font-size: 10pt;
}

.invoice-info {
    text-align: right;
}

.invoice-info h1 {
    margin: 0;
    color: #f39c12;
    font-size: 28pt;
    font-weight: 700;
}

.invoice-info p {
    margin: 5pt 0 0 0;
    font-size: 10pt;
}

.client-info {
    margin-bottom: 40pt;
    background: rgba(255, 255, 255, 0.03);
    padding: 15pt;
    border-radius: 16pt;
    border: 1px solid #374151;
}

.client-info h3 {
    margin: 0 0 8pt 0;
    font-size: 9pt;
    color: #f39c12;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.client-info p {
    margin: 0;
    line-height: 1.5;
    font-size: 11pt;
}

.table-wrapper {
    border-radius: 16pt;
    overflow: hidden;
    border: 1px solid #374151;
    margin-bottom: 30pt;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f39c12;
    color: white;
    padding: 14pt;
    text-align: left;
    text-transform: uppercase;
    font-size: 9pt;
    letter-spacing: 1px;
    border: none;
}

td {
    padding: 14pt;
    border-bottom: 1pt solid #374151;
    font-size: 10pt;
}

tr:last-child td {
    border-bottom: none;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.totals-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30pt;
}

.totals-table {
    width: 200pt;
    border-collapse: collapse;
}

.totals-table td {
    border: none;
    padding: 6pt 12pt;
}

.total-row td {
    padding-top: 15pt;
    font-weight: 700;
    font-size: 16pt;
    color: #f39c12;
}

.payment-section {
    margin-top: 10pt;
    padding-top: 20pt;
    text-align: center;
    border-top: 1px solid #374151;
}

.payment-section p {
    font-size: 9pt;
    color: #9ca3af;
    margin-bottom: 12pt;
}

.paypal-button {
    display: inline-flex;
    align-items: center;
    background-color: #f39c12;
    color: white !important;
    padding: 12pt 32pt;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 700;
    font-size: 10pt;
    transition: transform 0.2s, background-color 0.2s;
    border: none;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.2);
}

.paypal-button svg {
    margin-right: 10pt;
    fill: white;
}

.paypal-button:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        margin: 0;
        background-color: rgb(28, 28, 28) !important;
        color: #e5e7eb !important;
    }

    .app-container {
        display: block;
    }

    .input-panel {
        display: none !important;
    }

    .preview-container {
        padding: 0;
        background-color: rgb(28, 28, 28) !important;
    }

    .invoice-page {
        width: 210mm;
        height: 297mm;
        margin: 0;
    }

    .page-content {
        border: none !important;
        box-shadow: none;
        padding: 20mm;
        height: 100%;
        min-height: 100%;
        background-color: rgb(28, 28, 28) !important;
        border-radius: 0 !important;
        color: #e5e7eb !important;
        margin: 0 !important;
    }

    .invoice-page {
        background-color: rgb(28, 28, 28) !important;
    }

    .seller-info p {
        color: #e5e7eb !important;
    }

    .client-info {
        border: 1px solid #374151 !important;
        background: rgba(255, 255, 255, 0.03) !important;
        color: #e5e7eb !important;
    }

    .table-wrapper {
        border: 1px solid #374151 !important;
    }

    td {
        border-bottom: 1pt solid #374151 !important;
        color: #e5e7eb !important;
    }

    .invoice-info h1,
    .client-info h3,
    .total-row td {
        color: #f39c12 !important;
    }

    th {
        background-color: #f39c12 !important;
        color: white !important;
    }

    .paypal-button {
        display: none !important;
    }

    .payment-section p {
        color: #9ca3af !important;
    }

    .payment-section {
        border-top: 1px solid #374151 !important;
    }

    .totals-table td {
        color: #e5e7eb !important;
    }
}

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

    .input-panel {
        border-right: none;
        border-bottom: 1px solid #374151;
        max-height: none;
    }
}