/* 3D Printing Cost Calculator Styles */

/* CLS (Cumulative Layout Shift) Prevention */
/* Reserve space for dynamic elements to prevent layout shifts */

/* Images with width/height attributes automatically maintain aspect ratio */
/* No additional CSS needed - browsers handle this natively */

/* Reserve space for ad containers */
.adsbygoogle-container {
    min-height: 250px;
    height: 250px;
    min-width: 320px;
    aspect-ratio: 16 / 9;
}

/* Reserve space for alerts/notifications */
.alert-placeholder,
.toast-container,
.notification-container {
    min-height: 50px;
}

/* Hide content without removing height (prevents CLS) */
.hidden-but-space {
    visibility: hidden;
    height: auto;
}

/* Reserve space for lazy-loaded sections */
.lazy-section {
    min-height: 200px;
}

/* Hero images with aspect ratio */
.hero-image {
    aspect-ratio: 16 / 9;
}

/* Blog post images */
.blog-image {
    aspect-ratio: 1200 / 630;
}

/* Product images */
.product-image {
    aspect-ratio: 300 / 240;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #374151;
}

/* Prevent horizontal drift on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Lightweight design system tokens */
:root {
    --brand: #4f46e5;
    --brand-strong: #4338ca;
    --surface: #ffffff;
    --surface-muted: #f7f8fb;
    --border: #e5e7eb;
    --text-strong: #0f172a;
    --text: #1f2937;
    --text-muted: #6b7280;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.dark {
    --surface: #0f172a;
    --surface-muted: #111827;
    --border: #1f2937;
    --text-strong: #e5e7eb;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.28);
    --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 32px);
    gap: clamp(20px, 3vw, 28px);
}

.app-hero {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding: clamp(20px, 4vw, 36px);
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.1), transparent 35%), linear-gradient(135deg, #eef2ff, #f8fafc);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.dark .app-hero {
    background: radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.16), transparent 32%), linear-gradient(135deg, #0b1220, #0f172a);
    border-color: #1f2937;
}

.app-hero h1,
.app-section-title {
    color: var(--text-strong);
    letter-spacing: -0.01em;
}

.dark .app-hero h1,
.dark .app-section-title {
    color: var(--text-strong);
}

.app-hero p {
    color: var(--text-muted);
    max-width: 720px;
}

.app-hero .cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    background: rgba(79, 70, 229, 0.12);
    color: #312e81;
}

.dark .pill {
    background: rgba(79, 70, 229, 0.16);
    color: #c7d2fe;
}

.app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.card-body {
    padding: clamp(16px, 3vw, 22px);
}

.btn-solid,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-solid {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.25);
}

.btn-solid:hover {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    border-color: var(--brand);
    color: var(--brand-strong);
}

.dark .btn-ghost {
    border-color: #1f2937;
    color: var(--text);
}

.dark .btn-ghost:hover {
    border-color: var(--brand);
    color: #c7d2fe;
}

/* Navigation Container - Remove any spacing */
#navigation-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    display: block;
}

/* Header Styles */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #111;
    color: #fff;
    position: sticky;
    top: 0 !important;
    left: 0;
    right: 0;
    z-index: 1300;
    width: 100%;
    margin: 0 !important;
    border: none;
}

/* Logo */
.header .logo {
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
}

.header .logo img {
    height: 40px;
    width: auto;
    max-width: 200px;
}

/* Menu Toggle Button */
.menu-toggle {
    font-size: 24px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: block;
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    width: 100%;
    background: #111;
    display: none;
    z-index: 1200;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    border-bottom: 1px solid #222;
}

.mobile-nav a,
.dropdown-toggle {
    display: block;
    padding: 14px 16px;
    color: #fff;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.mobile-nav a:hover,
.dropdown-toggle:hover {
    background: #222;
}

/* Dropdown Menu */
.dropdown-menu {
    display: none;
    background: #1a1a1a;
}

.dropdown-menu li {
    border-bottom: 1px solid #2a2a2a;
}

.dropdown.active .dropdown-menu {
    display: block;
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 16px;
}

.desktop-nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 14px;
    white-space: nowrap;
}

.desktop-nav a:hover {
    background: #222;
}

.desktop-nav .dropdown {
    position: relative;
}

.desktop-nav .desktop-dropdown {
    color: #fff;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.desktop-nav .desktop-dropdown:hover {
    background: #222;
}

.desktop-nav .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 180px;
    background: #1a1a1a;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
    display: none;
    z-index: 1001;
}

.desktop-nav .dropdown:hover .dropdown-menu {
    display: block;
}

.desktop-nav .dropdown-menu li {
    border-bottom: 1px solid #2a2a2a;
}

.desktop-nav .dropdown-menu li:last-child {
    border-bottom: none;
}

.desktop-nav .dropdown-menu a {
    padding: 10px 16px;
    border-radius: 0;
    display: block;
}

.desktop-nav .dropdown-menu a:hover {
    background: #222;
}

.dark-mode-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    border-radius: 4px;
    transition: background 0.2s;
}

.dark-mode-btn:hover {
    background: #222;
}

@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .mobile-nav {
        display: none;
    }
    
    .desktop-nav {
        display: flex;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Advanced Mode CSS */
.advanced-only { 
    display: none !important; 
}

html.advanced-on .advanced-only { 
    display: block !important; 
}

/* Form Styles */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #4f46e5;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-moz-range-track {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    background: #4f46e5;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* Custom Checkbox */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    width: 1rem;
    height: 1rem;
    position: relative;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: #4f46e5;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .lg\:col-span-6,
    .lg\:col-span-3 {
        grid-column: span 1;
    }
    
    .text-4xl {
        font-size: 2rem;
    }
    
    .p-8 {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .bg-gradient-to-br {
        background: white !important;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error States */
.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success States */
.success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.success-message {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus States - Compatible with Tailwind CSS */
.focus\:ring-2:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #4f46e5;
}

/* Hover Effects */
.hover\:scale-105:hover {
    transform: scale(1.05);
}

.hover\:shadow-lg:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Transition Effects */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Utility Classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur {
    backdrop-filter: blur(8px);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Dark Mode Styles */
.dark {
    color-scheme: dark;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Dark mode input styling */
.dark input[type="text"],
.dark input[type="number"],
.dark input[type="email"],
.dark input[type="password"],
.dark select,
.dark textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark input[type="text"]:focus,
.dark input[type="number"]:focus,
.dark input[type="email"]:focus,
.dark input[type="password"]:focus,
.dark select:focus,
.dark textarea:focus {
    border-color: #6366f1;
    background-color: #374151;
}

/* Dark mode checkbox */
.dark input[type="checkbox"] {
    background-color: #374151;
    border-color: #4b5563;
}

.dark input[type="checkbox"]:checked {
    background-color: #6366f1;
    border-color: #6366f1;
}

/* Dark mode table */
.dark table {
    color: #f9fafb;
}

.dark table th {
    color: #e5e7eb;
    border-color: #4b5563;
}

.dark table td {
    border-color: #4b5563;
}

.dark table tr:hover {
    background-color: #374151;
}


/* =========================
   Calculator UI dark mode patches (class-based dark mode)
   These do NOT rely on Tailwind dark: variants existing in your build.
   ========================= */

.dark #rowTotalCost {
    background: rgba(17, 24, 39, 0.40); /* slate-900 @ 40% */
    border-color: #4b5563; /* gray-600 */
}

.dark #rowTotalCost span {
    color: #e5e7eb; /* gray-200 */
}

.dark #totalCost {
    color: #f9fafb; /* gray-50 */
}

.dark #rowSuggestedPrice {
    background: rgba(30, 27, 75, 0.55); /* indigo-950-ish */
    border-color: rgba(79, 70, 229, 0.75); /* indigo-600 */
}

.dark #rowSuggestedPrice span,
.dark #suggestedSellingPrice {
    color: #e0e7ff; /* indigo-100 */
}

/* Profit preset buttons (100% / 200% / 300%) */
.dark button[data-profit-preset],
.dark .profit-preset-btn {
    background: #374151 !important; /* gray-700 */
    color: #f9fafb !important;      /* gray-50 */
    border: 1px solid #4b5563 !important; /* gray-600 */
}

.dark button[data-profit-preset]:hover,
.dark .profit-preset-btn:hover {
    background: #4b5563 !important; /* gray-600 */
}

.dark button[data-profit-preset]:focus-visible,
.dark .profit-preset-btn:focus-visible {
    outline: 2px solid #6366f1; /* indigo-500 */
    outline-offset: 2px;
}

/* Pricing Templates card inside recommendations */
.dark #pricingTemplatesCard {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important; /* gray-800 -> slate-900 */
    border-color: #4b5563 !important; /* gray-600 */
}

.dark #pricingTemplatesCard h4,
.dark #pricingTemplatesCard p {
    color: #e5e7eb;
}

.dark #pricingTemplatesCard a {
    color: #86efac; /* green-300 */
}

.dark #pricingTemplatesCard a:hover {
    color: #bbf7d0; /* green-200 */
}



/* =========================
   Calculator page container overrides
   If Tailwind wasn't built with darkMode: 'class', the dark:* utilities
   in HTML won't work. These rules force dark-mode styling ONLY inside
   the calculator UI (#calculatorPage).
   ========================= */

/* Card/panel backgrounds */
.dark #calculatorPage .bg-white {
  background-color: #1f2937 !important; /* gray-800 */
}

/* Light section backgrounds used as subtle highlight boxes */
.dark #calculatorPage .bg-gray-50 {
  background-color: rgba(17, 24, 39, 0.55) !important; /* slate-900 @ 55% */
}

/* Borders that look too light in dark mode */
.dark #calculatorPage .border-gray-200,
.dark #calculatorPage .border-gray-300 {
  border-color: #374151 !important; /* gray-700 */
}

/* Default text colors inside calculator cards (when markup uses gray text utilities) */
.dark #calculatorPage .text-gray-900,
.dark #calculatorPage .text-gray-800 {
  color: #f9fafb !important; /* gray-50 */
}

.dark #calculatorPage .text-gray-700,
.dark #calculatorPage .text-gray-600 {
  color: #d1d5db !important; /* gray-300 */
}

.dark #calculatorPage .text-gray-500 {
  color: #9ca3af !important; /* gray-400 */
}

/* Fix light gradients inside calculator UI (recommendations + CTA boxes) */
.dark #calculatorPage .from-indigo-50 { --tw-gradient-from: #1f2937 !important; --tw-gradient-to: rgb(31 41 55 / 0) !important; }
.dark #calculatorPage .to-purple-50   { --tw-gradient-to: #111827 !important; }
.dark #calculatorPage .from-blue-50   { --tw-gradient-from: #1f2937 !important; --tw-gradient-to: rgb(31 41 55 / 0) !important; }
.dark #calculatorPage .to-indigo-50   { --tw-gradient-to: #111827 !important; }
.dark #calculatorPage .from-green-50  { --tw-gradient-from: #1f2937 !important; --tw-gradient-to: rgb(31 41 55 / 0) !important; }
.dark #calculatorPage .to-emerald-50  { --tw-gradient-to: #111827 !important; }

/* Info boxes used in calculator UI */
.dark #calculatorPage .bg-blue-50   { background-color: rgba(30, 58, 138, 0.18) !important; }
.dark #calculatorPage .bg-orange-50 { background-color: rgba(124, 45, 18, 0.22) !important; }
.dark #calculatorPage .bg-yellow-50 { background-color: rgba(113, 63, 18, 0.22) !important; }
.dark #calculatorPage .bg-green-50  { background-color: rgba(20, 83, 45, 0.22) !important; }
.dark #calculatorPage .bg-purple-50 { background-color: rgba(88, 28, 135, 0.18) !important; }

.dark #calculatorPage .border-blue-200   { border-color: rgba(30, 64, 175, 0.55) !important; }
.dark #calculatorPage .border-orange-200 { border-color: rgba(194, 65, 12, 0.55) !important; }
.dark #calculatorPage .border-yellow-200 { border-color: rgba(161, 98, 7, 0.55) !important; }
.dark #calculatorPage .border-green-200  { border-color: rgba(22, 163, 74, 0.45) !important; }
.dark #calculatorPage .border-purple-200 { border-color: rgba(147, 51, 234, 0.45) !important; }

/* Copy buttons inside results area */
.dark #calculatorPage button[data-copy-target] {
  background: #374151 !important;
  color: #f9fafb !important;
  border: 1px solid #4b5563 !important;
}
.dark #calculatorPage button[data-copy-target]:hover {
  background: #4b5563 !important;
}
