/* PizzaLogic Pro: Artisan Dough Calculator - Styles */

/* Color scheme variables */
:root {
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-color: #667eea;
    --primary-hover: #764ba2;
    --card-bg: white;
    --card-text: #333;
    --card-heading: #667eea;
    --label-color: #555;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --input-bg: white;
    --step-title: #333;
    --step-text: #555;
    --tip-bg: #f8f9fa;
    --header-text: white;
}

/* Dark theme */
[data-theme="dark"] {
    --primary-start: #1a1a2e;
    --primary-end: #16213e;
    --primary-color: #e94560;
    --primary-hover: #ff6b6b;
    --card-bg: #1f1f1f;
    --card-text: #e0e0e0;
    --card-heading: #e94560;
    --label-color: #aaa;
    --border-color: #444;
    --border-light: #333;
    --input-bg: #2a2a2a;
    --step-title: #e0e0e0;
    --step-text: #bbb;
    --tip-bg: #2a2a2a;
    --header-text: #e0e0e0;
}

/* Light theme */
[data-theme="light"] {
    --primary-start: #f5f7fa;
    --primary-end: #e4e8eb;
    --primary-color: #5a67d8;
    --primary-hover: #4c51bf;
    --card-bg: white;
    --card-text: #333;
    --card-heading: #5a67d8;
    --label-color: #555;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --input-bg: white;
    --step-title: #333;
    --step-text: #555;
    --tip-bg: #f8f9fa;
    --header-text: #333;
}

/* Cool theme */
[data-theme="cool"] {
    --primary-start: #2193b0;
    --primary-end: #6dd5ed;
    --primary-color: #2193b0;
    --primary-hover: #1a7a94;
    --card-bg: white;
    --card-text: #333;
    --card-heading: #2193b0;
    --label-color: #555;
    --border-color: #d0e8f0;
    --border-light: #e8f4f8;
    --input-bg: white;
    --step-title: #333;
    --step-text: #555;
    --tip-bg: #e8f7fa;
    --header-text: white;
}

/* Warm theme */
[data-theme="warm"] {
    --primary-start: #ee9ca7;
    --primary-end: #ffdde1;
    --primary-color: #d35d6e;
    --primary-hover: #c44d5e;
    --card-bg: #fffaf8;
    --card-text: #4a3f3f;
    --card-heading: #d35d6e;
    --label-color: #6b5858;
    --border-color: #f0d8d8;
    --border-light: #fae8e8;
    --input-bg: white;
    --step-title: #4a3f3f;
    --step-text: #6b5858;
    --tip-bg: #fff5f5;
    --header-text: #4a3f3f;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    min-height: 100vh;
    padding: 12px;
    color: var(--card-text);
    font-size: 14px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: var(--header-text);
    margin-bottom: 12px;
    font-size: 1.6em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    margin-bottom: 12px;
}

.card h2 {
    color: var(--card-heading);
    margin-bottom: 12px;
    font-size: 1.15em;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

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

label {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--label-color);
    font-size: 0.85em;
}

input[type="number"],
select {
    padding: 8px;
    border: 2px solid var(--border-color);
    font-size: 0.95em;
    transition: border-color 0.3s;
    background-color: var(--input-bg);
    color: var(--card-text);
}

select {
    border-radius: 8px;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
}

select {
    cursor: pointer;
    background-color: var(--input-bg);
}

.results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.result-item {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 12px 8px;
    border-radius: 8px;
    text-align: center;
}

.result-label {
    font-size: 0.8em;
    opacity: 0.9;
    margin-bottom: 2px;
}

.result-value {
    font-size: 1.4em;
    font-weight: bold;
}

.result-unit {
    font-size: 0.7em;
    opacity: 0.8;
}

.result-tsp {
    font-size: 0.7em;
    opacity: 0.85;
    margin-top: 2px;
}

.info-text {
    background: var(--tip-bg);
    padding: 10px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--step-text);
    border-left: 3px solid var(--primary-color);
    line-height: 1.5;
}

.starter-note {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.85em;
    color: #856404;
}

/* Instructions styling */
.instructions-container {
    margin-top: 12px;
}

.instruction-phase {
    margin-bottom: 16px;
}

.instruction-phase:last-child {
    margin-bottom: 0;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95em;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--border-light);
}

.phase-icon {
    font-size: 1.1em;
}

.instruction-step {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85em;
    line-height: 1.5;
    color: var(--step-text);
}

.instruction-step:last-child {
    border-bottom: none;
}

.step-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    color: var(--step-title);
}

.step-tip {
    display: block;
    margin-top: 6px;
    padding: 6px 10px;
    background: var(--tip-bg);
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--step-text);
    border-left: 2px solid var(--primary-color);
}

/* Custom stepper control styles */
.stepper {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.stepper-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.stepper-btn[data-action="dec"] {
    border-radius: 6px 0 0 6px;
}

.stepper-btn[data-action="inc"] {
    border-radius: 0 6px 6px 0;
}

.stepper-btn:hover {
    opacity: 0.9;
}

.stepper-btn:active {
    opacity: 0.8;
}

.stepper-value {
    flex: 1;
    text-align: center;
    font-size: 0.95em;
    font-weight: 600;
    padding: 0 6px;
    background: var(--input-bg);
    color: var(--card-text);
    border: none;
    min-width: 50px;
    height: 36px;
}

.stepper-value:focus {
    outline: none;
    background: #f8f8f8;
}

/* Hide native number input spinners */
.stepper-value::-webkit-outer-spin-button,
.stepper-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.stepper-value[type=number] {
    -moz-appearance: textfield;
}

/* Two-column grid for compact fields */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-2col .form-group {
    margin-bottom: 0;
}

/* Temperature unit toggle */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.toggle-label {
    font-size: 0.8em;
    color: #555;
    font-weight: 600;
}

.toggle-label.active {
    color: var(--primary-color);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 22px;
    background: var(--primary-color);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.celsius::after {
    transform: translateX(22px);
}

/* Mode toggle styles */
.mode-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.mode-toggle {
    display: flex;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 3px;
}

.mode-btn {
    padding: 7px 18px;
    border: none;
    background: transparent;
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 17px;
    transition: all 0.3s;
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
}

.mode-btn:not(.active):hover {
    background: rgba(255,255,255,0.1);
}

/* Style cards for simple mode */
.style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.style-card {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: var(--card-bg);
}

.style-card:hover {
    border-color: var(--primary-color);
}

.style-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 10%, transparent) 0%, color-mix(in srgb, var(--primary-hover) 10%, transparent) 100%);
}

.style-card-name {
    font-weight: 700;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.style-card-desc {
    font-size: 0.75em;
    color: #777;
}

/* Time selector for simple mode */
.time-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.time-option {
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 0.9em;
    background: var(--card-bg);
}

.time-option:hover {
    border-color: var(--primary-color);
}

.time-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 10%, transparent) 0%, color-mix(in srgb, var(--primary-hover) 10%, transparent) 100%);
}

/* Dough details toggle */
.details-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 0.9em;
}

.details-toggle:hover {
    color: var(--primary-hover);
}

.details-toggle-icon {
    transition: transform 0.2s;
    font-size: 0.75em;
}

.details-toggle-icon.open {
    transform: rotate(90deg);
}

.details-content {
    display: none;
    margin-top: 10px;
}

.details-content.open {
    display: block;
}

.details-summary {
    background: var(--tip-bg);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.85em;
    line-height: 1.5;
}

.details-summary .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid var(--border-light);
}

.details-summary .detail-row:last-child {
    border-bottom: none;
}

.details-summary .detail-label {
    color: var(--step-text);
}

.details-summary .detail-value {
    font-weight: 600;
    color: var(--step-title);
}

.details-summary .detail-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    color: var(--step-text);
    font-size: 0.8em;
}

/* Info toggle (About Calculations) */
.info-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85em;
}

.info-toggle:hover {
    color: var(--primary-hover);
}

.info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: bold;
    font-style: italic;
    flex-shrink: 0;
}

.info-content {
    display: none;
    margin-top: 10px;
}

.info-content.open {
    display: block;
}

.calc-info-section {
    background: var(--tip-bg);
    border-radius: 8px;
    padding: 12px;
}

.calc-info-step {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85em;
    line-height: 1.5;
    color: var(--step-text);
}

.calc-info-step:last-child {
    border-bottom: none;
}

/* Preset buttons for advanced mode */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-btn {
    padding: 6px 12px;
    border: 2px solid var(--primary-color);
    background: var(--card-bg);
    color: var(--primary-color);
    font-size: 0.8em;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border-color: transparent;
}

.preset-btn:active {
    transform: scale(0.98);
}

.preset-btn.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border-color: transparent;
}

.preset-btn.preset-custom {
    border-style: dashed;
}

.preset-btn.preset-custom.selected {
    border-style: solid;
}

.preset-size-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* Theme selector */
.theme-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-selector label {
    color: var(--header-text);
    font-size: 0.8em;
    font-weight: 600;
}

.theme-selector select {
    padding: 5px 8px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.2);
    color: var(--header-text);
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
}

.theme-selector select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
}

.theme-selector select option {
    color: #000;
    background: #fff;
}

[data-theme="light"] .theme-selector select {
    border-color: rgba(0,0,0,0.2);
    background: rgba(0,0,0,0.05);
}

.preset-size-input {
    max-width: 280px;
}

/* Hidden class */
.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    body {
        padding: 8px;
    }

    h1 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }

    .card {
        padding: 12px;
        border-radius: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-2col {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stepper-btn {
        width: 34px;
        height: 34px;
        font-size: 1.1em;
    }

    .stepper-value {
        min-width: 40px;
        height: 34px;
    }

    .result-item {
        padding: 10px 6px;
    }

    .result-value {
        font-size: 1.2em;
    }

    .preset-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }
}
