/* ===== Analyze Page Styles ===== */

.analyze-main {
    min-height: 100vh;
    padding-top: 100px;
    padding-bottom: 60px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.analyze-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Progress Bar ===== */

.progress-bar {
    margin-bottom: 40px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #64748b;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
}

.step.completed .step-number {
    background: #10b981;
    color: white;
}

.step span {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
}

.progress-line {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ===== Form Steps ===== */

.form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.form-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    text-align: center;
    margin-bottom: 32px;
}

.step-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.step-header p {
    color: #64748b;
    font-size: 16px;
}

/* ===== Form Groups ===== */

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Required field indicator */
.form-group:has(input[required]) label::after,
.form-group:has(select[required]) label::after,
.dual-column-row:has(input[required]) label::after {
    content: '*';
    color: #ef4444;
    font-weight: 600;
    margin-left: 2px;
}

/* Invalid field styling */
.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid,
.form-group input.error,
.form-group select.error {
    border-color: #ef4444;
}

.form-group input:invalid:not(:placeholder-shown):focus,
.form-group select:invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 12px;
    cursor: help;
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    max-width: 250px;
    white-space: normal;
    z-index: 100;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
    color: #0f172a;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: #94a3b8;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #94a3b8;
}

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

/* ===== Dual Column Layout (MTD | YTD) ===== */

.dual-column-header {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.dual-column-header .column-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.dual-column-header .column-label:first-child {
    text-align: left;
}

.dual-column-row {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.dual-column-row:last-of-type {
    border-bottom: none;
}

.dual-column-row label {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dual-column-row .input-with-currency input {
    padding: 10px 12px 10px 50px;
    font-size: 15px;
}

.dual-column-row.calculated {
    background: #f8fafc;
    margin: 8px 0;
    padding: 12px 0;
    border-radius: 8px;
    border-bottom: none;
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 16px;
    align-items: center;
}

.dual-column-row.calculated.highlight {
    background: #1e3a5f;
    color: white;
}

.dual-column-row.calculated span:first-child {
    font-weight: 500;
    color: #64748b;
}

.dual-column-row.calculated.highlight span:first-child {
    color: rgba(255, 255, 255, 0.8);
}

.dual-column-row.calculated .calculated-value {
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    color: #1e3a5f;
}

.dual-column-row.calculated.highlight .calculated-value {
    color: white;
}

@media (max-width: 640px) {
    .dual-column-header,
    .dual-column-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dual-column-header .column-label:first-child {
        display: none;
    }

    .dual-column-row label {
        grid-column: 1 / -1;
        margin-bottom: 4px;
    }

    .dual-column-row .input-with-currency {
        position: relative;
    }

    .dual-column-row .input-with-currency::before {
        content: attr(data-label);
        position: absolute;
        top: -18px;
        left: 0;
        font-size: 11px;
        color: #64748b;
    }
}

/* ===== VAT Section ===== */

.vat-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px dashed #cbd5e1;
}

.vat-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 4px;
}

.vat-section .section-hint {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
}

/* ===== Input with Currency ===== */

.input-with-currency {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-prefix {
    position: absolute;
    left: 16px;
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
    pointer-events: none;
}

.input-with-currency input {
    padding-left: 54px;
}

/* ===== Calculated Fields ===== */

.calculated-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-bottom: 24px;
}

.calculated-field span:first-child {
    font-weight: 500;
    color: #475569;
}

.calculated-value {
    font-weight: 700;
    font-size: 18px;
    color: #0f172a;
}

.calculated-field.highlight {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border: 1px solid #bfdbfe;
}

.calculated-field.highlight .calculated-value {
    color: var(--primary);
}

.calculated-field small {
    display: block;
    width: 100%;
    text-align: right;
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* ===== Input Method Toggle ===== */

.input-method-toggle {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid #e2e8f0;
}

.input-method-toggle p {
    font-weight: 500;
    color: #334155;
    margin-bottom: 16px;
    text-align: center;
}

.toggle-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.toggle-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.toggle-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.toggle-btn svg {
    color: #64748b;
}

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

.toggle-btn span {
    font-weight: 600;
    color: #334155;
}

.toggle-btn small {
    font-size: 12px;
    color: #94a3b8;
}

/* ===== Upload Zone ===== */

.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon {
    margin-bottom: 16px;
    color: #94a3b8;
}

.upload-zone h3 {
    font-size: 18px;
    color: #334155;
    margin-bottom: 4px;
}

.upload-zone p {
    color: #94a3b8;
    margin-bottom: 16px;
}

.accepted-formats {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.accepted-formats span {
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 4px;
}

/* ===== Uploaded Files List ===== */

.uploaded-files {
    margin-top: 20px;
}

.uploaded-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
}

.uploaded-file .file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.uploaded-file .file-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.uploaded-file .file-name {
    font-weight: 500;
    color: #334155;
}

.uploaded-file .file-size {
    font-size: 12px;
    color: #94a3b8;
}

.uploaded-file .remove-file {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

.uploaded-file .remove-file:hover {
    color: #ef4444;
}

/* ===== Upload Tips ===== */

.upload-tips {
    margin-top: 24px;
    padding: 20px;
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 12px;
}

.upload-tips h4 {
    font-size: 14px;
    color: #854d0e;
    margin-bottom: 12px;
}

.upload-tips ul {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.upload-tips li {
    font-size: 14px;
    color: #713f12;
    padding: 4px 0;
}

.tip-note {
    font-size: 13px;
    color: #a16207;
    font-style: italic;
}

/* ===== Comparison Choice ===== */

.comparison-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 32px;
}

.choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.choice-btn.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.choice-icon {
    width: 64px;
    height: 64px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #64748b;
}

.choice-btn.selected .choice-icon {
    background: var(--primary);
    color: white;
}

.choice-btn h3 {
    font-size: 16px;
    color: #334155;
    margin-bottom: 4px;
}

.choice-btn p {
    font-size: 13px;
    color: #94a3b8;
}

/* ===== Comparison Fields ===== */

.comparison-fields {
    padding: 24px;
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.comparison-fields h3 {
    font-size: 16px;
    color: #334155;
    margin-bottom: 20px;
    text-align: center;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* ===== Form Actions ===== */

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-generate {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    padding: 16px 32px;
    font-size: 17px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

/* ===== Loading State ===== */

.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-animation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.loading-circle {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingBounce 1.4s ease-in-out infinite;
}

.loading-circle:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-circle:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-state h2 {
    font-size: 24px;
    color: #0f172a;
    margin-bottom: 8px;
}

.loading-message {
    color: #64748b;
    margin-bottom: 32px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 280px;
    margin: 0 auto;
    gap: 12px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #94a3b8;
}

.loading-step svg {
    opacity: 0;
}

.loading-step.active {
    color: #334155;
}

.loading-step.completed svg {
    opacity: 1;
    color: #10b981;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
    .analyze-main {
        padding-top: 80px;
    }

    .step-header h1 {
        font-size: 22px;
    }

    .progress-steps {
        gap: 4px;
    }

    .step span {
        display: none;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .toggle-options,
    .comparison-choice {
        grid-template-columns: 1fr;
    }

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

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

    .form-actions {
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
    }
}

/* ===== Template Section ===== */

.template-section {
    margin-bottom: 24px;
}

.template-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
}

.template-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    flex-shrink: 0;
}

.template-info {
    flex: 1;
}

.template-info h4 {
    font-size: 15px;
    color: #065f46;
    margin-bottom: 2px;
}

.template-info p {
    font-size: 13px;
    color: #047857;
    margin: 0;
}

.template-box .btn-sm {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
}

/* ===== Format Guide ===== */

.format-guide {
    margin-top: 24px;
}

.format-guide-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-guide-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.format-guide-toggle svg:first-child {
    color: #3b82f6;
}

.format-guide-toggle .chevron {
    margin-left: auto;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.format-guide-toggle.open .chevron {
    transform: rotate(180deg);
}

.format-guide-content {
    margin-top: 12px;
    padding: 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.format-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.format-column h5 {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.format-column li {
    font-size: 13px;
    color: #475569;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.format-column li:last-child {
    border-bottom: none;
}

.format-column code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #0f172a;
    font-family: 'SF Mono', Consolas, monospace;
}

.format-example {
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.format-example h5 {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
}

.example-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.example-table th,
.example-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #e2e8f0;
}

.example-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
}

.example-table td {
    color: #475569;
}

.example-table tbody tr:nth-child(even) {
    background: #fafafa;
}

@media (max-width: 640px) {
    .template-box {
        flex-direction: column;
        text-align: center;
    }

    .template-box .btn-sm {
        width: 100%;
    }

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

    .example-table {
        font-size: 12px;
    }

    .example-table th,
    .example-table td {
        padding: 8px;
    }
}

/* ===== Validation Toast ===== */

.validation-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.validation-toast svg {
    flex-shrink: 0;
}

.validation-toast.fade-out {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ===== Login Required Screen ===== */

.login-required {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.login-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-icon svg {
    color: var(--primary);
}

.login-required h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.login-required p {
    font-size: 16px;
    color: #64748b;
    max-width: 400px;
    margin: 0 auto 32px;
}

.login-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.login-note {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 0;
}

/* ===== Section Divider ===== */

.section-divider {
    margin: 28px 0 20px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.section-divider h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.section-divider p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* Legacy - keep for backwards compatibility */
.cash-movements-fields .form-group {
    margin-bottom: 16px;
}

.cash-movements-fields .form-group:last-of-type {
    margin-bottom: 20px;
}

.cash-movements-fields .calculated-field {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.cash-movements-fields .calculated-field span:first-child {
    color: #92400e;
}

.cash-movements-fields .calculated-value {
    color: #b45309;
}
