/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: #0B0F0B;
    color: #EDF2ED;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --bg-dark: #0B0F0B;
    --surface: #131A13;
    --card-bg: #1A221A;
    --border-dim: #2A342A;
    --primary: #5ad16a;
    --primary-dark: #3fb94f;
    --text-muted: #A8B5A8;
    --success: #4CAF50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196F3;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

@media (min-width: 640px) {
    .container {
        padding: 0 20px;
    }
}

/* ===== TEXT STYLES ===== */
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-block;
    background: #5ad16a;
    color: #0B0F0B;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
}

@media (min-width: 640px) {
    .btn-primary {
        padding: 14px 40px;
        width: auto;
    }
}

.btn-primary:hover {
    background: #3fb94f;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(90, 209, 106, 0.3);
}

.btn-sm {
    background: #2A342A;
    color: #E8EDE8;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (min-width: 640px) {
    .btn-sm {
        width: 32px;
        height: 32px;
    }
}

.btn-sm:hover { background: #3a4a3a; }
.btn-sm:active { transform: scale(0.92); }

/* ===== CARDS ===== */
.input-card {
    background: #141A14;
    border: 1px solid #2A342A;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    width: 100%;
}

@media (min-width: 640px) {
    .input-card {
        padding: 24px;
        margin-bottom: 20px;
    }
}

.input-card h3 {
    color: #E8EDE8;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.results-card {
    background: #141A14;
    border: 1px solid #2A342A;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    width: 100%;
}

@media (min-width: 640px) {
    .results-card {
        padding: 24px;
        margin-bottom: 20px;
    }
}

.results-card h3 {
    color: #E8EDE8;
    margin-bottom: 16px;
    font-size: 0.85rem;
    padding-bottom: 8px;
    border-bottom: 2px solid #2A342A;
}

/* ===== MACHINE SELECTOR ===== */
.machine-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

@media (min-width: 640px) {
    .machine-selector {
        gap: 20px;
    }
}

@media (min-width: 900px) {
    .machine-selector {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.machine-card {
    background: #1A221A;
    border: 2px solid #2A342A;
    border-radius: 16px;
    padding: 16px 12px 12px;
    text-align: center;
    transition: all 0.3s;
    width: 100%;
}

@media (min-width: 640px) {
    .machine-card {
        padding: 20px 16px 16px;
    }
}

.machine-card:hover {
    border-color: #4a5a4a;
    transform: translateY(-2px);
}

.machine-card.selected {
    border-color: #5ad16a;
    background: #1F2A1F;
    box-shadow: 0 0 30px rgba(90, 209, 106, 0.1);
}

/* === BILDER - INDIVIDUELL pro Automat === */
.machine-card .machine-image {
    width: 100%;
    max-width: 120px;
    height: 100px;
    object-fit: contain;
    margin: 0 auto 8px;
    display: block;
    transition: transform 0.3s ease;
}

@media (min-width: 640px) {
    .machine-card .machine-image {
        max-width: 160px;
        height: 150px;
        margin: 0 auto 10px;
    }
}

.machine-card:hover .machine-image {
    transform: scale(1.05);
}

.machine-card.selected .machine-image {
    transform: scale(1.03);
}

.machine-card h4 {
    color: #E8EDE8;
    font-size: 0.95rem;
    margin: 4px 0 2px;
}

@media (min-width: 640px) {
    .machine-card h4 {
        font-size: 1.05rem;
    }
}

.machine-card .slots {
    color: #A8B5A8;
    font-size: 0.7rem;
}

@media (min-width: 640px) {
    .machine-card .slots {
        font-size: 0.8rem;
    }
}

.machine-card .price {
    color: #5ad16a;
    font-weight: 700;
    font-size: 0.85rem;
}

@media (min-width: 640px) {
    .machine-card .price {
        font-size: 0.95rem;
    }
}

.machine-card .specs {
    color: #6a7a6a;
    font-size: 0.6rem;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid #2A342A;
}

@media (min-width: 640px) {
    .machine-card .specs {
        font-size: 0.7rem;
        margin-top: 6px;
        padding-top: 8px;
    }
}

.machine-card .price-unit {
    font-size: 0.6rem;
    color: #8a9a8a;
}

@media (min-width: 640px) {
    .machine-card .price-unit {
        font-size: 0.7rem;
    }
}

/* Counter in der Machine-Card */
.counter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #2A342A;
    flex-wrap: wrap;
}

@media (min-width: 640px) {
    .counter-wrapper {
        gap: 10px;
        margin-top: 12px;
        padding-top: 12px;
    }
}

.counter-wrapper .count-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: #E8EDE8;
    min-width: 32px;
    text-align: center;
}

@media (min-width: 640px) {
    .counter-wrapper .count-display {
        font-size: 1.4rem;
        min-width: 40px;
    }
}

.counter-wrapper .count-label {
    font-size: 0.6rem;
    color: #8a9a8a;
}

@media (min-width: 640px) {
    .counter-wrapper .count-label {
        font-size: 0.65rem;
    }
}

.counter-wrapper .sub-total {
    font-size: 0.7rem;
    color: #5ad16a;
    font-weight: 600;
    min-width: 50px;
}

@media (min-width: 640px) {
    .counter-wrapper .sub-total {
        font-size: 0.8rem;
        min-width: 60px;
    }
}

/* ===== SLIDER ===== */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    flex-wrap: wrap;
}

.input-label {
    color: #A8B5A8;
    font-size: 0.8rem;
}

@media (min-width: 640px) {
    .input-label {
        font-size: 0.9rem;
    }
}

.input-value {
    color: #E8EDE8;
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 50px;
    text-align: right;
}

@media (min-width: 640px) {
    .input-value {
        font-size: 1.1rem;
        min-width: 60px;
    }
}

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #2A342A;
    border-radius: 3px;
    outline: none;
    touch-action: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5ad16a;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5ad16a;
    cursor: pointer;
    border: none;
}

@media (min-width: 640px) {
    input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }
    input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.5rem;
    color: #5a6a5a;
    margin-top: 2px;
}

@media (min-width: 640px) {
    .range-labels {
        font-size: 0.6rem;
    }
}

.recommendation {
    font-size: 0.6rem;
}

@media (min-width: 640px) {
    .recommendation {
        font-size: 0.65rem;
    }
}

.hint-text {
    font-size: 0.65rem;
    text-align: center;
}

@media (min-width: 640px) {
    .hint-text {
        font-size: 0.7rem;
    }
}

/* ===== RESULTS ===== */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (min-width: 640px) {
    .results-grid {
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
}

.result-box {
    background: #1A221A;
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
}

@media (min-width: 640px) {
    .result-box {
        padding: 10px 12px;
    }
}

.result-box .result-label {
    font-size: 0.5rem;
    color: #8a9a8a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (min-width: 640px) {
    .result-box .result-label {
        font-size: 0.6rem;
    }
}

.result-box .result-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: #E8EDE8;
    margin-top: 2px;
    word-break: break-word;
}

@media (min-width: 640px) {
    .result-box .result-number {
        font-size: 1.1rem;
    }
}

.result-box .result-number.large {
    font-size: 1.2rem;
}

@media (min-width: 640px) {
    .result-box .result-number.large {
        font-size: 1.5rem;
    }
}

/* ===== TOTAL STATS ===== */
.total-stats {
    background: #1A221A;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 8px;
}

@media (min-width: 640px) {
    .total-stats {
        padding: 12px 16px;
        gap: 10px;
    }
}

.total-stats .stat-item {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.total-stats .stat-item .stat-label {
    font-size: 0.5rem;
    color: #8a9a8a;
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .total-stats .stat-item .stat-label {
        font-size: 0.6rem;
    }
}

.total-stats .stat-item .stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #E8EDE8;
}

@media (min-width: 640px) {
    .total-stats .stat-item .stat-value {
        font-size: 1.2rem;
    }
}

.total-stats .stat-item .stat-value.primary {
    color: #5ad16a;
}

/* ===== LAYOUT ===== */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr 1.2fr;
        gap: 24px;
    }
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 640px) {
    .chart-row {
        gap: 20px;
        margin-top: 20px;
    }
}

@media (min-width: 768px) {
    .chart-row {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

.balance-chart {
    background: #141A14;
    border: 1px solid #2A342A;
    border-radius: 16px;
    padding: 16px;
    width: 100%;
}

@media (min-width: 640px) {
    .balance-chart {
        padding: 20px;
    }
}

.balance-chart h4 {
    color: #A8B5A8;
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 12px;
}

@media (min-width: 640px) {
    .balance-chart h4 {
        font-size: 0.8rem;
    }
}

.balance-chart canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 200px;
}

@media (min-width: 640px) {
    .balance-chart canvas {
        max-height: 250px;
    }
}

.section-title {
    font-size: 0.95rem;
}

@media (min-width: 640px) {
    .section-title {
        font-size: 1rem;
    }
}

/* ===== PAGE HEADER ===== */
.page-header {
    padding: 20px 0 16px;
}

@media (min-width: 640px) {
    .page-header {
        padding: 30px 0 20px;
    }
}

.page-header h1 {
    font-size: 1.6rem;
    color: #E8EDE8;
}

@media (min-width: 640px) {
    .page-header h1 {
        font-size: 2.2rem;
    }
}

/* ===== CTA SECTION ===== */
.cta-section {
    margin: 24px 0;
}

@media (min-width: 640px) {
    .cta-section {
        margin: 40px 0;
    }
}

/* ===== DISCLAIMER ===== */
.disclaimer {
    font-size: 0.55rem;
    margin-top: 10px;
    text-align: center;
}

@media (min-width: 640px) {
    .disclaimer {
        font-size: 0.6rem;
    }
}

/* ===== MISC ===== */
.mt-20 { margin-top: 20px; }
hr { border-color: #2A342A; margin: 10px 0; }

main {
    flex: 1;
    margin-top: 70px;
    padding-bottom: 20px;
}

@media (min-width: 640px) {
    main {
        margin-top: 80px;
    }
}

/* ===== MOBILE FIRST TOUCH IMPROVEMENTS ===== */
button, 
input[type="range"],
.machine-card,
.btn-primary {
    touch-action: manipulation;
}

input[type="range"] {
    min-height: 30px;
}

@media (hover: none) {
    .machine-card:hover {
        transform: none;
        border-color: #2A342A;
    }
    .machine-card.selected:hover {
        border-color: #5ad16a;
    }
    .btn-primary:hover {
        transform: none;
    }
}