/* German Tax Tool V2 - Single Page Professional Styles */

/* Base styles */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Form inputs */
.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-size: 0.9375rem;
    color: #111827;
    background-color: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: #9ca3af;
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.2);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input:disabled {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

/* Portfolio table */
#portfolio-table {
    border-collapse: collapse;
}

#portfolio-table th {
    background-color: transparent;
    position: relative;
}

#portfolio-table td {
    vertical-align: top;
}

/* Year cell styles */
.year-cell {
    transition: background-color 0.15s;
}

.year-cell:hover {
    background-color: #f9fafb;
}

/* Popover animation */
#year-edit-popover {
    animation: popoverIn 0.15s ease-out;
}

@keyframes popoverIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide-in panel */
#sale-calc-panel {
    transition: transform 0.3s ease-in-out;
}

#sale-calc-panel:not(.translate-x-full) {
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

/* Accordion */
.accordion-item {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #111827;
    text-align: left;
    transition: background-color 0.15s;
}

.accordion-header:hover {
    background-color: #f9fafb;
}

.accordion-icon {
    transition: transform 0.2s;
    color: #9ca3af;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 2000px;
}

.accordion-body {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Details/Summary for collapsible panels */
details > summary {
    cursor: pointer;
}

details > summary::-webkit-details-marker {
    display: none;
}

/* Results styling */
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.result-label {
    color: #6b7280;
}

.result-value {
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.result-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #e5e7eb;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.draft {
    color: #9ca3af;
}

.status-badge.filed {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* Monospace numbers */
.mono-numbers {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
}

/* Print styles */
@media print {
    header, footer, button, #sale-calc-panel, #sale-calc-backdrop, #year-edit-popover, #fund-modal {
        display: none !important;
    }

    body {
        background-color: white;
    }

    details {
        display: block !important;
    }

    details > summary {
        display: none !important;
    }

    details > div {
        display: block !important;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    #portfolio-table {
        font-size: 0.875rem;
    }

    #sale-calc-panel {
        max-width: 100%;
    }
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #9ca3af;
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background-color: #e5e7eb;
    color: #111827;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Animation for saved notification */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.2s ease-out;
}

/* Table hover effects */
#portfolio-tbody tr {
    transition: background-color 0.15s;
}

/* Horizontal scroll hint */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Button hover states */
button {
    transition: all 0.15s;
}

/* Info icon button with tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid #9ca3af;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 500;
    font-style: normal;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: help;
    vertical-align: middle;
    margin-left: 3px;
    line-height: 1;
    padding-bottom: 1px;
}

.info-icon:hover {
    border-color: #6b7280;
    color: #6b7280;
}

/* Tooltip container - use fixed positioning to escape overflow */
.has-tooltip {
    position: relative;
}

.has-tooltip .tooltip-text {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    width: 220px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.has-tooltip:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
}
