:root {
    --primary: #8a2be2;
    --primary-light: #a64dff;
    --secondary: #00d2ff;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    background-image: radial-gradient(circle at 10% 20%, rgba(138, 43, 226, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 210, 255, 0.15) 0%, transparent 40%);
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-area img {
    height: 40px;
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.editor-layout {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.invoice-form {
    width: 100%;
    max-width: 800px;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.2);
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Item Row Styling */
.item-row {
    display: grid;
    grid-template-columns: 3fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.remove-item {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.remove-item:hover {
    background: #ef4444;
    color: white;
}

/* Preview Paper Styling */
.invoice-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1000;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.invoice-paper {
    background: white;
    color: #1e293b;
    padding: 4rem;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    min-height: 800px;
    transform: rotateX(2deg) rotateY(-2deg);
    transition: transform 0.5s ease;
}

.invoice-preview-container:hover .invoice-paper {
    transform: rotateX(0) rotateY(0);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.preview-logo {
    height: 60px;
    margin-bottom: 1rem;
}

.agency-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

.agency-info p {
    color: #64748b;
    font-size: 0.9rem;
}

.invoice-meta h1 {
    font-size: 3rem;
    font-weight: 900;
    color: #e2e8f0;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.invoice-meta p {
    text-align: right;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.invoice-to {
    margin-bottom: 3rem;
}

.invoice-to h4 {
    text-transform: uppercase;
    color: #94a3b8;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.invoice-to p {
    font-weight: 600;
    font-size: 1.1rem;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3rem;
}

.invoice-table th {
    text-align: left;
    padding: 1rem;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.invoice-table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-summary {
    width: 300px;
    margin-left: auto;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #64748b;
}

.summary-line.total {
    border-top: 2px solid #8a2be2;
    margin-top: 1rem;
    padding-top: 1rem;
    color: #1e293b;
    font-weight: 800;
    font-size: 1.2rem;
}

.invoice-footer {
    margin-top: 5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 2rem;
}

@media print {
    body * {
        visibility: hidden;
    }

    .invoice-paper,
    .invoice-paper * {
        visibility: visible;
    }

    .invoice-paper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        transform: none !important;
    }
}

@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
}