/* ==========================================================================
   AYUVAN Shipping Suite - Design System & Stylesheet
   Theme: Apple meets Notion (Minimalist, Premium, Warm Muted Palette)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES & DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Color Palette */
    --bg-main: #F8F7F4;
    --primary-green: #1F5E3B;
    --primary-green-hover: #17482D;
    --primary-green-active: #103520;
    --light-green: #DCE9DF;
    --light-green-subtle: #F1F6F2;
    --border-color: #E7E7E7;
    --card-bg: #FFFFFF;

    /* Text Colors */
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-danger: #D32F2F;
    --danger-bg: #FEEFC3;
    --danger-hover: #F8D7DA;

    /* Elevation & Shadows */
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
    --shadow-floating: 0 20px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-input-focus: 0 0 0 3px rgba(31, 94, 59, 0.15);

    /* Border Radii */
    --radius-card: 16px;
    --radius-btn: 10px;
    --radius-input: 8px;
    --radius-sm: 6px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* App Wrapper */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------------------------
   3. HEADER STYLES
   -------------------------------------------------------------------------- */
.app-header {
    height: 72px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-green);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   4. MAIN LAYOUT (40% / 60% Split)
   -------------------------------------------------------------------------- */
.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 32px;
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 1200px) {
    .app-main {
        grid-template-columns: 40% 60%;
    }
}

/* --------------------------------------------------------------------------
   5. FORM PANEL (LEFT 40%)
   -------------------------------------------------------------------------- */
.form-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#shipping-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Cards */
.form-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.form-card:hover {
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.06);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #FAFAFA;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: var(--light-green);
    color: var(--primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Form Inputs & Rows */
.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 {
    flex: 1;
    min-width: 0;
}

.flex-2 {
    flex: 2;
    min-width: 0;
}

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

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-auto {
    font-size: 0.65rem;
    font-weight: 700;
    background-color: var(--light-green);
    color: var(--primary-green);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

input[type="text"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: #FAFAFA;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-input);
    outline: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23444444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px 16px;
    padding-right: 38px;
    cursor: pointer;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    background-color: #FFFFFF;
    border-color: var(--primary-green);
    box-shadow: var(--shadow-input-focus);
}

select option {
    background-color: #FFFFFF;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 10px;
}

textarea {
    resize: vertical;
}

/* --------------------------------------------------------------------------
   6. BUTTONS & ACTIONS
   -------------------------------------------------------------------------- */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-btn);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-green);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(31, 94, 59, 0.25);
    flex: 1.2;
}

.btn-primary:hover {
    background-color: var(--primary-green-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(31, 94, 59, 0.35);
}

.btn-primary:active {
    background-color: var(--primary-green-active);
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--light-green);
    color: var(--primary-green);
    border-color: rgba(31, 94, 59, 0.15);
    flex: 1;
}

.btn-secondary:hover {
    background-color: #cce0d1;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #FFF2F2;
    color: var(--text-danger);
    border-color: #F8D7DA;
    flex: 0.8;
}

.btn-danger:hover {
    background-color: #FFE5E5;
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    background-color: #F0F0F0;
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   7. LIVE PREVIEW PANEL (RIGHT 60%)
   -------------------------------------------------------------------------- */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-sticky-wrapper {
    position: sticky;
    top: 104px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.preview-header {
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.preview-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--light-green);
    color: var(--primary-green);
    padding: 4px 10px;
    border-radius: 20px;
}

.shipping-label-container {
    padding: 24px;
    background-color: #EAE8E3;
    border-radius: 24px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 440px;
}

/* --------------------------------------------------------------------------
   8. PACKING LABEL DESIGN (100x150mm / 4x6 Thermal Output)
   -------------------------------------------------------------------------- */
.shipping-label {
    width: 380px;
    height: 570px;
    background-color: #FFFFFF;
    border: 2px solid #000000;
    box-shadow: none !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: var(--font-family);
    color: #000000;
    position: relative;
    user-select: none;
    overflow: hidden;
}

/* Major Section Block with Full-Width 2px Bottom Border */
.lbl-sec {
    padding: 5px 10px;
    border-bottom: 2px solid #000000;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-sizing: border-box;
}

.lbl-sec-last {
    padding: 5px 10px;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    box-sizing: border-box;
}

/* Section 1: Brand Header */
.lbl-brand-sec {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px 10px;
}

.lbl-brand-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    line-height: 1;
}

.lbl-brand-sub-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 8px;
    margin-top: 4px;
}

.lbl-sub-line {
    flex: 1;
    height: 1.5px;
    background-color: #000000;
}

.lbl-brand-sub {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Black Badge Tag Box (White Text on Black Box) */
.lbl-black-badge {
    background-color: #000000;
    color: #FFFFFF;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    display: inline-block;
    align-self: flex-start;
    border-radius: 1px;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 2px;
}

/* Vertical Split 2 Columns */
.lbl-grid-2-split {
    display: flex;
    width: 100%;
    align-items: stretch;
}

.lbl-col-split {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lbl-col-split.border-right {
    border-right: 1.5px solid #000000;
    padding-right: 10px;
}

.padding-left-md {
    padding-left: 10px;
}

/* Typography Values */
.lbl-val-xl {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #000000;
}

.lbl-val-md {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #000000;
}

.lbl-val-sm {
    font-size: 0.88rem;
    font-weight: 800;
    color: #000000;
}

.lbl-sub-tag {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #333333;
}

/* Sender & Receiver Address Details */
.lbl-sender-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: #000000;
}

.lbl-sender-address {
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.25;
    color: #111111;
}

.lbl-customer-name {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.15;
    color: #000000;
}

.lbl-customer-phone {
    font-size: 0.85rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 2px;
}

.lbl-address-block {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.25;
    color: #000000;
}

.lbl-city-state-pin {
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

.lbl-product-name {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    color: #000000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lbl-inner-divider {
    height: 1px;
    background-color: #000000;
    margin: 4px 0;
    width: 100%;
}

/* Footer Section */
.lbl-footer-main {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #000000;
}

.lbl-footer-sub {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #222222;
}

.lbl-footer-return {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #222222;
}

.lbl-dashed-line {
    width: 100%;
    border-top: 1px dashed #000000;
    margin: 4px 0;
}

.lbl-footer-url {
    font-size: 0.68rem;
    font-weight: 700;
    color: #000000;
}

.lbl-footer-thankyou {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #000000;
}

/* --------------------------------------------------------------------------
   9. ANIMATIONS
   -------------------------------------------------------------------------- */
.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--delay, 0s);
    opacity: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .preview-sticky-wrapper {
        position: static;
    }

    .shipping-label-container {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .app-header {
        padding: 0 16px;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .app-main {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 14px;
    }

    .form-actions {
        flex-direction: column;
    }

    .shipping-label-container {
        overflow-x: auto;
        padding: 16px 8px;
    }

    .shipping-label {
        width: 380px !important;
        height: 570px !important;
        min-width: 380px !important;
        min-height: 570px !important;
        flex-shrink: 0;
    }
}

/* --------------------------------------------------------------------------
   11. PRINT STYLESHEET & PAGE SETUP (@page & @media print)
   Exact 4x6 Thermal Label Print setup (100mm x 150mm / 4in x 6in)
   -------------------------------------------------------------------------- */

/* Top-level @page rule for browser print preview engine */
@page {
    size: 4in 6in portrait;
    margin: 0;
}

@media print {
    @page {
        size: 4in 6in portrait;
        margin: 0;
    }

    /* Reset root document for 4x6 thermal paper */
    html,
    body {
        width: 4in !important;
        height: 6in !important;
        max-width: 4in !important;
        max-height: 6in !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #FFFFFF !important;
        overflow: hidden !important;
    }

    /* Completely hide all non-printable UI components */
    .app-header,
    .form-panel,
    .preview-header,
    .preview-badge,
    .header-actions,
    .status-indicator,
    .preview-title {
        display: none !important;
        visibility: hidden !important;
    }

    /* Flatten all container layouts for clean single-page thermal output */
    .app-wrapper,
    .app-main,
    .preview-panel,
    .preview-sticky-wrapper,
    .shipping-label-container {
        display: block !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 4in !important;
        height: 6in !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
    }

    /* Target 4x6 Shipping Label Canvas */
    .shipping-label {
        width: 4in !important;
        height: 6in !important;
        box-sizing: border-box !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: 2px solid #000000 !important;
        background-color: #FFFFFF !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Thermal printer high-contrast text & backgrounds */
    .shipping-label * {
        color: #000000 !important;
    }

    .lbl-ship-badge {
        background-color: #000000 !important;
        color: #FFFFFF !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}