:root {
    --primary-color: #ff6b35;
    /* Vibrant Orange */
    --hover-color: #e55039;
    --background-dark: #0a0a0a;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --font-main: 'Outfit', sans-serif;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: rgb(249, 112, 0);
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: var(--font-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(255, 107, 53, 0.39);
}

.btn-primary:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.23);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: rgba(255, 107, 53, 0.1);
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 80px 0;
    min-height: 80vh;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.highlight {
    color: var(--primary-color);
}

.hero-actions {
    display: flex;
    gap: 15px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.abstract-shape {
    width: 300px;
    /* Reduced complexity for CSS drawing */
    height: 300px;
    background: linear-gradient(45deg, var(--primary-color), #ff9f43);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 8s ease-in-out infinite;
    filter: blur(40px);
    opacity: 0.6;
}

@keyframes morph {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }

    50% {
        border-radius: 68% 32% 32% 68% / 58% 39% 61% 42%;
    }

    100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
}

/* Dashboard */
.dashboard-section {
    padding: 40px 0;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none;
    opacity: 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.card h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row>* {
    flex: 1;
}

.input-field {
    width: 100%;
    padding: 12px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    outline: none;
    transition: border-color 0.3s;
    font-family: var(--font-main);
}

.input-field:focus {
    border-color: var(--primary-color);
}

.textarea {
    min-height: 100px;
    resize: vertical;
}

.form-section-title {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 20px;
}

/* Preview / Albarán */
.preview-card {
    background-color: #f5f5f5;
    /* Paper-like */
    color: #333;
    /* Dark text for print */
    position: relative;
    border: none;
    /* Clean edges */
}

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

.preview-header .logo {
    color: var(--primary-color);
    /* Keep branding */
}

.preview-header .logo.small {
    font-size: 1.2rem;
}

.preview-meta {
    text-align: right;
    font-size: 0.9rem;
    color: #666;
    display: flex;
    flex-direction: column;
}

.preview-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-top: 2px dashed #ccc;
    padding-top: 20px;
}

.preview-route {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 20px;
}

.route-line {
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background-color: #ccc;
    z-index: 1;
}

.route-point {
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    margin-top: 5px;
    margin-left: -5px;
    /* Alignment fix */
}

.dot.start {
    background-color: var(--primary-color);
}

.dot.end {
    background-color: #333;
}

.address-box strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: #999;
}

.placeholder-text {
    font-size: 0.95rem;
    color: #333;
}

.preview-details {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    font-size: 0.8rem;
    color: #999;
}

.detail-item .value {
    font-weight: 600;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.barcode-area {
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.barcode {
    height: 40px;
    background: repeating-linear-gradient(to right,
            #333,
            #333 2px,
            transparent 2px,
            transparent 4px);
    width: 60%;
    margin: 0 auto 5px auto;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .navbar,
    .hero,
    .dashboard-controls,
    .form-card,
    .dashboard-header {
        display: none !important;
    }

    .dashboard-section {
        display: block !important;
        opacity: 1 !important;
        padding: 0;
    }

    .dashboard-grid {
        display: block;
        /* Stack */
    }

    .preview-card {
        box-shadow: none;
        border: 1px dashed #999;
        /* A5 size is roughly 148mm x 210mm. */
        /* To fit two on an A4 (210x297), we can stack them vertically or place them side-by-side if landscape. */
        /* Usually 'cuartilla' implies half-sheet. A5 is half of A4. */
        /* Let's target exactly half height of A4 minus some margin for safe printing. */
        width: 100%;
        height: 138mm;
        /* Slightly less than 148.5mm to ensure 2 fit vertically with margins */
        padding: 15px;
        font-size: 10pt;
        page-break-inside: avoid;
        margin-bottom: 5mm;
        display: block;
        position: relative;
    }

    .preview-card:last-child {
        margin-bottom: 0;
        border-top: 1px dotted #ccc;
        /* Visual separation if needed, though they are separate cards */
    }

    #printable-area {
        display: block;
        width: 100%;
        height: 100%;
    }

    /* Report Printing */
    .no-print {
        display: none !important;
    }

    .report-header-print {
        display: block !important;
    }

    #report-content {
        display: block;
        width: 100%;
    }

    #report-content table {
        width: 100% !important;
        border: 1px solid #000;
    }

    #report-content th,
    #report-content td {
        border: 1px solid #000 !important;
        color: #000 !important;
        padding: 5px;
    }

    #report-content .card {
        box-shadow: none;
        border: none;
        background: white;
        color: black;
    }

    /* Label Printing */
    .label-page-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        height: 100vh;
        width: 100vw;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .shipping-label {
        border: 1px dotted #ccc;
        padding: 5mm;
        box-sizing: border-box;
        page-break-inside: avoid;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;
        height: 148mm;
        /* A6 Height */
        position: relative;
    }

    .app-container {
        max-width: none;
        padding: 0;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        flex-direction: column;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }
}