/* Zinseszinsrechner - Professional Calculator Styles */

.zzr-calculator {
    --zzr-primary: #2563eb;
    --zzr-primary-hover: #1d4ed8;
    --zzr-primary-light: #eff6ff;
    --zzr-border: #e5e7eb;
    --zzr-border-focus: #2563eb;
    --zzr-text: #1f2937;
    --zzr-text-muted: #6b7280;
    --zzr-bg: #f9fafb;
    --zzr-card-bg: #ffffff;
    --zzr-success: #059669;
    --zzr-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --zzr-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.zzr-card {
    background: var(--zzr-card-bg);
    border-radius: 12px;
    box-shadow: var(--zzr-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.zzr-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--zzr-text);
    margin: 0 0 1.25rem 0;
}

.zzr-icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* Form fields */
.zzr-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.zzr-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.zzr-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--zzr-text);
}

.zzr-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--zzr-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
    transition: background 0.2s;
}

.zzr-tooltip-trigger:hover {
    background: var(--zzr-primary-hover);
}

.zzr-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.zzr-input-wrap input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.75rem;
    border: 2px solid var(--zzr-border);
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}

.zzr-input-wrap input:focus {
    outline: none;
    border-color: var(--zzr-border-focus);
    background: white;
}

.zzr-input-wrap input::placeholder {
    color: var(--zzr-text-muted);
}

.zzr-unit {
    position: absolute;
    right: 0.75rem;
    font-size: 0.875rem;
    color: var(--zzr-text-muted);
    pointer-events: none;
}

.zzr-select-wrap {
    padding: 0;
}

.zzr-select-wrap select {
    width: 100%;
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    border: 2px solid var(--zzr-border);
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #fafafa;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: border-color 0.2s, background 0.2s;
}

.zzr-select-wrap select:focus {
    outline: none;
    border-color: var(--zzr-border-focus);
    background-color: white;
}

/* Tooltip - only visible when hovering over ? icon */
.zzr-tooltip {
    font-size: 0.75rem;
    color: var(--zzr-text-muted);
    line-height: 1.4;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.2s, opacity 0.2s;
}

.zzr-field .zzr-tooltip.zzr-tooltip-active {
    max-height: 5em;
    opacity: 1;
}

/* Button */
.zzr-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--zzr-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.25rem;
    transition: background 0.2s, transform 0.15s;
}

.zzr-btn:hover {
    background: var(--zzr-primary-hover);
}

.zzr-btn:active {
    transform: scale(0.99);
}

/* Results */
.zzr-results {
    background: var(--zzr-card-bg);
    border-radius: 12px;
    box-shadow: var(--zzr-shadow);
    padding: 1.5rem;
}

.zzr-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--zzr-text);
    margin: 0 0 1rem 0;
}

.zzr-result-value-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.zzr-copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--zzr-border);
    border-radius: 6px;
    color: var(--zzr-text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.zzr-copy-btn:hover {
    color: var(--zzr-primary);
    border-color: var(--zzr-primary);
    background: var(--zzr-primary-light);
}

.zzr-explanation {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--zzr-bg);
    border-radius: 8px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--zzr-text);
}

.zzr-explanation strong {
    font-weight: 600;
    color: var(--zzr-text);
}

.zzr-chart-section {
    margin-bottom: 1.5rem;
}

.zzr-chart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.zzr-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--zzr-text);
    margin: 0;
}

.zzr-chart-download-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--zzr-primary);
    background: transparent;
    border: 1px solid var(--zzr-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.zzr-chart-download-btn:hover {
    background: var(--zzr-primary);
    color: white;
}

.zzr-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.6rem 1.25rem;
    background: var(--zzr-text);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: var(--zzr-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s, opacity 0.3s, visibility 0s 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.zzr-toast.zzr-toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform 0.3s, opacity 0.3s;
}

.zzr-results[hidden] {
    display: none !important;
}

.zzr-results-summary,
.zzr-explanation,
.zzr-save-wrap,
.zzr-chart-section,
.zzr-table-wrap {
    opacity: 0;
    animation: zzr-fade-in 0.4s ease forwards;
}

.zzr-results-summary { animation-delay: 0s; }
.zzr-explanation { animation-delay: 0.08s; }
.zzr-save-wrap { animation-delay: 0.16s; }
.zzr-chart-section { animation-delay: 0.24s; }
.zzr-table-wrap { animation-delay: 0.32s; }

@keyframes zzr-fade-in {
    to { opacity: 1; }
}

.zzr-results-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.zzr-result-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--zzr-bg);
    border-radius: 8px;
}

.zzr-result-item.zzr-result-end {
    background: var(--zzr-primary-light);
    border-left: 4px solid var(--zzr-primary);
}

.zzr-result-label {
    font-size: 0.875rem;
    color: var(--zzr-text-muted);
    flex-shrink: 0;
}

.zzr-result-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--zzr-text);
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: right;
}

.zzr-result-end .zzr-result-value {
    font-size: 1.25rem;
    color: var(--zzr-primary);
}

.zzr-result-interest {
    color: var(--zzr-success);
}

/* Chart */
.zzr-chart-wrap {
    position: relative;
    height: 220px;
    margin-bottom: 1.5rem;
}

/* Table */
.zzr-table-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--zzr-text);
    margin: 0 0 0.75rem 0;
}

.zzr-table-scroll {
    overflow-x: auto;
}

.zzr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.zzr-table th,
.zzr-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--zzr-border);
}

.zzr-table th {
    font-weight: 600;
    color: var(--zzr-text-muted);
}

.zzr-table td {
    color: var(--zzr-text);
}

.zzr-table td.zzr-num {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.zzr-table tbody tr:hover {
    background: var(--zzr-bg);
}

.zzr-table .zzr-num {
    text-align: right;
    max-width: 12em;
}

/* Error state */
.zzr-input-wrap input.zzr-error {
    border-color: #dc2626;
    background: #fef2f2;
}

/* Save/Download button */
.zzr-save-wrap {
    margin-top: 1rem;
}

.zzr-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--zzr-card-bg);
    border: 2px solid var(--zzr-border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--zzr-text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.zzr-save-btn:hover {
    border-color: var(--zzr-primary);
    background: var(--zzr-primary-light);
}

/* Responsive - fill container on all screens */
@media (min-width: 768px) {
    .zzr-calculator {
        max-width: 720px;
    }

    .zzr-card,
    .zzr-results {
        padding: 1.75rem;
    }

    .zzr-chart-wrap {
        height: 260px;
    }

    .zzr-table td.zzr-num {
        max-width: 14em;
    }
}

@media (min-width: 1024px) {
    .zzr-calculator {
        max-width: 860px;
    }
}
