/* -------------------------------------------------------------
   Design System & Variable Definitions
   ------------------------------------------------------------- */
:root {
    /* Color Tokens (Rose Gold & Elegant Sweet Pastel) */
    --color-primary: #b38292;         /* Elegant Dusty Rose */
    --color-primary-light: #e8c5cf;   /* Soft Rose Tint */
    --color-accent: #c8956b;          /* Soft Gold/Copper Accent */
    --color-sweet-pink: #fdf2f4;      /* Creamy Pink Background */
    --color-lavender: #f1ecf6;        /* Soft Lavender Background */
    
    --color-text-dark: #4a3b40;       /* Rich Charcoal Cocoa */
    --color-text-muted: #857279;      /* Muted Cocoa Gray */
    --color-white: #ffffff;
    
    /* Layout & Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-shadow: 0 12px 40px 0 rgba(199, 137, 160, 0.12);
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    
    /* Typography */
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
    
    /* Animations */
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
}

/* -------------------------------------------------------------
   Base Resets & Setup
   ------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text-dark);
    background-color: #faf7f8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 1.5rem;
}

/* Abstract Background Circles (Aesthetic Glows) */
.bg-gradient-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.45;
}

.circle-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #fde2e4 0%, rgba(255, 255, 255, 0) 70%);
    top: -10vw;
    left: -10vw;
}

.circle-2 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #e2dbec 0%, rgba(255, 255, 255, 0) 70%);
    bottom: -15vw;
    right: -10vw;
}

.circle-3 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, #fff0f3 0%, rgba(255, 255, 255, 0) 70%);
    top: 30vh;
    left: 40vw;
}

/* -------------------------------------------------------------
   Main App Container
   ------------------------------------------------------------- */
.app-container {
    width: 100%;
    max-width: 1100px;
    min-height: 80vh;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 10;
}

/* -------------------------------------------------------------
   Header Styling
   ------------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(179, 130, 146, 0.15);
    padding-bottom: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    border-radius: 50%;
    color: var(--color-white);
    box-shadow: 0 8px 16px rgba(179, 130, 146, 0.25);
}

.brand-text h1 {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 2rem;
    color: var(--color-primary);
    line-height: 1.1;
}

.brand-text p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* -------------------------------------------------------------
   Layout Content Grid
   ------------------------------------------------------------- */
.main-content {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: 2rem;
    align-items: start;
}

/* Base Card Style */
.card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.015);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* -------------------------------------------------------------
   Tab Navigation (Manual vs AI)
   ------------------------------------------------------------- */
.tab-container {
    display: flex;
    background: rgba(179, 130, 146, 0.08);
    padding: 0.35rem;
    border-radius: 50px;
    border: 1px solid rgba(179, 130, 146, 0.05);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.8rem 1rem;
    border-radius: 50px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.tab-btn i {
    width: 18px;
    height: 18px;
}

.tab-btn.active {
    background: var(--color-white);
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(179, 130, 146, 0.15);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-smooth);
}

/* -------------------------------------------------------------
   Forms & Custom Inputs
   ------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tooltip-trigger {
    color: var(--color-text-muted);
    cursor: help;
    display: inline-flex;
    align-items: center;
}

.tooltip-trigger i {
    width: 14px;
    height: 14px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 0.9rem 3.5rem 0.9rem 1.1rem;
    border: 1px solid rgba(179, 130, 146, 0.25);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    color: var(--color-text-dark);
    background: rgba(255, 255, 255, 0.9);
    transition: var(--transition-fast);
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(179, 130, 146, 0.12);
}

.input-suffix {
    position: absolute;
    right: 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    pointer-events: none;
}

/* Inline row styling */
.form-row {
    margin-bottom: 1rem;
}

.form-row-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* -------------------------------------------------------------
   Button Styling (Primary & Secondary)
   ------------------------------------------------------------- */
.btn-primary, .btn-secondary, .btn-danger {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    color: var(--color-white);
    width: 100%;
    box-shadow: 0 6px 18px rgba(179, 130, 146, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(179, 130, 146, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #dfd7d9;
    color: #a49699;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(179, 130, 146, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(179, 130, 146, 0.15);
}

.btn-secondary:hover {
    background: rgba(179, 130, 146, 0.15);
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(179, 130, 146, 0.15);
    background: rgba(255, 255, 255, 0.6);
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-white);
    transform: rotate(25deg);
    box-shadow: 0 4px 10px rgba(179, 130, 146, 0.15);
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    color: var(--color-text-dark);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-icon-small:hover {
    transform: scale(1.15);
}

.btn-danger {
    background: #f7e6e6;
    color: #c94c4c;
}

.btn-danger:hover {
    background: #f0cece;
}

/* -------------------------------------------------------------
   Drag & Drop Image Upload Zone
   ------------------------------------------------------------- */
.image-upload-zone {
    width: 100%;
    height: 220px;
    border: 2px dashed rgba(179, 130, 146, 0.35);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition-smooth);
}

.image-upload-zone:hover, .image-upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(179, 130, 146, 0.05);
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.upload-prompt h3 {
    font-size: 1rem;
    font-weight: 600;
}

.upload-prompt p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    max-width: 250px;
    margin-bottom: 0.5rem;
}

.upload-preview {
    width: 100%;
    height: 100%;
    position: relative;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 5;
}

/* IA Spinner & Status */
.ai-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-sm);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3.5px solid rgba(179, 130, 146, 0.15);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#aiStatusText {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-primary);
}

/* -------------------------------------------------------------
   Output Results Section
   ------------------------------------------------------------- */
.results-section {
    min-height: 400px;
    display: flex;
    justify-content: center;
}

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    color: var(--color-text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--color-primary-light);
    margin-bottom: 0.5rem;
    animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
}

.empty-state h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--color-primary);
}

.empty-state p {
    font-size: 0.95rem;
    max-width: 380px;
    line-height: 1.5;
}

/* Active Cost Calculation Styling */
.results-content {
    width: 100%;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.subtotal-container {
    text-align: center;
    background: linear-gradient(to right, rgba(241, 236, 246, 0.5), rgba(253, 242, 244, 0.5));
    border: 1px solid rgba(179, 130, 146, 0.1);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.subtotal-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

.subtotal-price {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(179, 130, 146, 0.15);
    padding-bottom: 1.5rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.item-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-text-muted);
}

.bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.bullet-material { background-color: var(--color-accent); }
.bullet-energy { background-color: #79a3b1; }
.bullet-amortization { background-color: #bfa290; }
.bullet-maintenance { background-color: var(--color-primary); }

.item-value {
    font-weight: 600;
    color: var(--color-text-dark);
}

/* Pricing / Profitability Section */
.pricing-calculator {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pricing-calculator h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.profit-controls {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1rem;
}

.profit-controls .form-group {
    margin-bottom: 0;
}

/* Custom Slider Styling */
.range-slider-container {
    width: 100%;
    padding: 0.5rem 0;
}

.range-slider-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: rgba(179, 130, 146, 0.15);
    outline: none;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-white);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(179, 130, 146, 0.3);
    transition: var(--transition-fast);
}

.range-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.retail-price-container {
    text-align: center;
    background: linear-gradient(135deg, var(--color-sweet-pink) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 1.5px solid var(--color-primary-light);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(179, 130, 146, 0.08);
}

.retail-label {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-primary);
}

.retail-price {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0.25rem;
    text-shadow: 0 2px 10px rgba(179, 130, 146, 0.1);
}

/* -------------------------------------------------------------
   AI Benchmark Card Styling
   ------------------------------------------------------------- */
.ai-benchmark-card {
    margin-top: 1.5rem;
    border: 1px solid rgba(179, 130, 146, 0.12);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
}

.benchmark-header {
    background: rgba(179, 130, 146, 0.06);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(179, 130, 146, 0.08);
}

.badge {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.badge i {
    width: 12px;
    height: 12px;
}

.benchmark-range {
    font-weight: 700;
    color: var(--color-accent);
}

.benchmark-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.benchmark-explanation {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Price Meter Styling */
.price-comparison-meter {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.meter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-dark);
}

.meter-bar {
    width: 100%;
    height: 8px;
    background: rgba(179, 130, 146, 0.1);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #8ebf8d, var(--color-accent), #c94c4c);
    border-radius: 5px;
    transition: var(--transition-smooth);
}

.meter-status {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    text-align: right;
}

/* -------------------------------------------------------------
   Settings Sidebar Panel
   ------------------------------------------------------------- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(74, 59, 64, 0.35);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 440px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--glass-border);
    box-shadow: -10px 0 40px rgba(74, 59, 64, 0.08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: var(--transition-smooth);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(179, 130, 146, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-family: var(--font-serif);
    color: var(--color-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.settings-group {
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.settings-group h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 1rem;
    border-left: 3px solid var(--color-primary);
    padding-left: 0.5rem;
}

.settings-help {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.btn-password-toggle {
    position: absolute;
    right: 0.5rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.5rem;
}

.btn-password-toggle i {
    width: 18px;
    height: 18px;
}

/* -------------------------------------------------------------
   Toast & Animation Keyframes
   ------------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-text-dark);
    color: var(--color-white);
    padding: 0.85rem 1.75rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: var(--transition-smooth);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------
   Responsive Mobile Adjustments
   ------------------------------------------------------------- */
@media (max-width: 900px) {
    body {
        padding: 1rem;
    }
    
    .app-container {
        padding: 1.5rem;
        min-height: auto;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .brand-text h1 {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .app-header {
        flex-direction: row;
        align-items: center;
    }
    
    .card {
        padding: 1.25rem;
    }
    
    .profit-controls {
        grid-template-columns: 1fr;
    }
    
    .subtotal-price {
        font-size: 2.2rem;
    }
    
    .retail-price {
        font-size: 2.4rem;
    }
}
