/* 
 * 3DPrice - Professional 3D Printing Cost Calculator
 * Design: Modern SaaS Style, Dark/Light Themes
 */

 :root {
    /* Color Palette - Dark Theme (Default) */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #f97316;
    --secondary-hover: #ea580c;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.main-header {
    background-color: var(--bg-card);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

.logo span {
    color: var(--secondary);
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#theme-toggle:hover {
    background-color: var(--bg-input);
}

/* Layout Grid */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
    
    .results-sidebar {
        order: -1;
    }
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2, .card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header i {
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

label i {
    font-size: 0.75rem;
    cursor: help;
}

input, select {
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Step Summaries */
.step-summary {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.9rem;
}

.step-summary strong {
    color: var(--primary);
}

/* Colors Grid */
.colors-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.color-item {
    padding: 1rem;
    background-color: var(--bg-input);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.color-item-header {
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
}

/* Sidebar Results */
.sticky {
    position: sticky;
    top: 5.5rem;
}

.result-highlight {
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.main-price {
    background: linear-gradient(135deg, var(--primary), #1e40af);
    color: white;
}

.production-cost {
    background-color: var(--bg-input);
}

.result-highlight .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.result-highlight .value {
    font-size: 1.75rem;
    font-weight: 800;
}

.result-summary {
    margin: 1.5rem 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.summary-item:last-child {
    border-bottom: none;
}

.highlight-margin {
    color: var(--secondary);
    font-weight: 500;
}

.divider {
    height: 1px;
    background-color: var(--border);
    margin: 1.5rem 0;
}

/* Chart */
.chart-container {
    margin-top: 1.5rem;
    position: relative;
    height: 250px;
}

/* Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: none;
}

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); }

.btn-secondary { background-color: var(--bg-input); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background-color: var(--border); transform: translateY(-2px); }

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

.btn-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background-color: var(--danger); color: white; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

/* Info Box */
.info-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 0.5rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.hidden { display: none; }

.modal {
    background-color: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.25rem; border-top: 1px solid var(--border); text-align: right; }

/* Utility Classes */
.mb-4 { margin-bottom: 1rem; }

/* Footer */
.main-footer {
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Print Styles */
@media print {
    .main-header, .action-buttons, .card-actions, .main-footer, #theme-toggle {
        display: none !important;
    }
    
    body { background-color: white !important; color: black !important; }
    
    .grid-layout { display: block !important; }
    
    .card {
        border: 1px solid #ccc !important;
        break-inside: avoid;
        box-shadow: none !important;
    }
    
    .sticky { position: static !important; }
}
