:root {
    --background: hsl(0, 0%, 99%);
    --foreground: hsl(158, 64%, 8%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(158, 64%, 8%);
    --primary: hsl(158, 64%, 20%);
    --primary-foreground: hsl(0, 0%, 98%);
    --secondary: hsl(152, 24%, 94%);
    --secondary-foreground: hsl(158, 64%, 15%);
    --muted: hsl(152, 16%, 96%);
    --muted-foreground: hsl(158, 16%, 45%);
    --accent: hsl(162, 48%, 88%);
    --accent-foreground: hsl(158, 64%, 15%);
    --success: hsl(142, 76%, 36%);
    --success-foreground: hsl(0, 0%, 98%);
    --destructive: hsl(0, 84%, 60%);
    --destructive-foreground: hsl(0, 0%, 98%);
    --border: hsl(152, 20%, 88%);
    --input: hsl(152, 20%, 92%);
    --ring: hsl(158, 64%, 20%);
    --financial-primary: hsl(158, 64%, 20%);
    --financial-success: hsl(142, 76%, 36%);
    --financial-light: hsl(152, 24%, 94%);
    --financial-accent: hsl(162, 48%, 88%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--background), var(--financial-light), var(--financial-accent));
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.head-section {
    background: linear-gradient(135deg, var(--primary), var(--financial-success));
    color: var(--primary-foreground);
    text-align: center;
}
.hero-section {
    padding: 3rem 0 3rem;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--financial-success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--muted-foreground);
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.calc-section {
    padding: 3rem 0 3rem;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.process-steps {
    padding: 4rem 0;
    background: linear-gradient(180deg, var(--background), var(--financial-light));
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--muted-foreground);
    text-align: center;
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.step-card {
    background: var(--card);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    position: relative;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.step-number {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.step-icon {
    width: 4rem;
    height: 4rem;
    background: var(--financial-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto 1rem;
}

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.features-section {
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--financial-light), var(--financial-accent));
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--card);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--financial-success));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.security-section {
    padding: 3rem 0;
    background: var(--background);
}

.security-badges {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.security-icon {
    width: 1.5rem;
    height: 1.5rem;
    background: var(--success);
    border-radius: 0.25rem;
}

.cta-section {
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary), var(--financial-success));
    color: var(--primary-foreground);
    text-align: center;
}

.cta-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
}

.cta-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.btn-white {
    background: var(--primary-foreground);
    color: var(--primary);
    border: none;
    font-weight: 700;
}

.btn-white:hover {
    background: var(--financial-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }
    .head-section .container > div:nth-child(2) {
        position: static !important;
        transform: none !important;
        justify-content: center;
        order: -1;
      }

      .head-section .container {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
      }

      #authButtonContainer {
        width: 100%;
        justify-content: center;
        margin-left: 0 !important;
        padding-right: 0 !important;
      }

      #authButtonContainer button {
        flex: 1;
        min-width: 120px;
      }

}

/* for modal */

.btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--financial-success));
    color: var(--primary-foreground);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card);
    border-radius: 1rem;
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8) translate(0, 0);
    transition: transform 0.3s ease;
    transform-origin: center center;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--muted);
    color: var(--foreground);
}

.modal-body {
    padding: 2rem;
}

.upload-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--muted);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted-foreground);
    transition: all 0.2s ease;
}

.tab.active {
    background: var(--card);
    color: var(--foreground);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.upload-zone {
    padding: 3rem 2rem;
    border: 2px dashed var(--border);
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--financial-light), var(--background));
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--financial-light);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    opacity: 0.1;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    opacity: 0.2;
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.upload-description {
    color: var(--muted-foreground);
    margin-bottom: 2rem;
}

.file-input {
    display: none;
}

.uploaded-files {
    margin-top: 2rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-icon {
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    border-radius: 0.25rem;
    opacity: 0.1;
}

.file-info {
    flex: 1;
    text-align: left;
}

.file-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.success-message {
    color: var(--success);
    font-weight: 600;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 121, 78, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    cursor: pointer;
}

.form-textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

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

.transaction-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.type-option {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--background);
}

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

.type-option.selected {
    border-color: var(--primary);
    background: var(--financial-light);
    color: var(--primary);
}

.type-option .type-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.type-option .type-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-secondary {
    background: var(--muted);
    color: var(--muted-foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

@media (max-width: 768px) {

    .btn, .tab, .type-option {
        min-height: 44px; /* iOS accessibility guideline */
        min-width: 44px;
    }

    .button-group {
        flex-direction: column;
        align-items: stretch;
        max-width: 300px;
        margin: 0 auto;
    }

    .button-group .btn {
        width: 100%;
        /* min-width: 44px is already inherited and satisfied by width: 100% */
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

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

    .transaction-type-selector {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .upload-tabs {
        flex-direction: column;
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.form-input.error {
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    color: var(--destructive);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}