:root {
    --primary-color: #00d9ff;
    --primary-hover: #00b8d4;
    --secondary-color: #64ffda;
    --success-color: #00e676;
    --danger-color: #ff1744;
    --background: #0a0e27;
    --surface: #1a1f3a;
    --border: #2a3353;
    --text-primary: #e0f7ff;
    --text-secondary: #80deea;
    --text-muted: #546e7a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 217, 255, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 217, 255, 0.2), 0 2px 4px -1px rgba(0, 217, 255, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 217, 255, 0.25), 0 4px 6px -2px rgba(0, 217, 255, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 217, 255, 0.3), 0 10px 10px -5px rgba(0, 217, 255, 0.2);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f2027 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 217, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(100, 255, 218, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

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

/* Header */
.header {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 217, 255, 0.2);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.header-content {
    text-align: center;
    margin-bottom: 1.5rem;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.title-icon {
    height: 2.5rem;
    width: 2.5rem;
    max-width: 2.5rem;
    max-height: 2.5rem;
    object-fit: contain;
    vertical-align: middle;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.privacy-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.privacy-notice svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Form Container */
.form-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(0, 217, 255, 0.15);
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.optional {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}

label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: rgba(10, 14, 39, 0.5);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.2);
}

input[type="text"]:hover,
input[type="tel"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
select:hover,
textarea:hover {
    border-color: var(--text-secondary);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Date input calendar icon styling */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    cursor: pointer;
    opacity: 0.8;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    filter: invert(1) brightness(2);
}

.form-help {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-help a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-help a:hover {
    text-decoration: underline;
}

/* Image Upload */
.image-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    position: relative;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

.btn-remove-image {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.btn-remove-image:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

input[type="file"] {
    padding: 0.5rem;
    font-size: 0.875rem;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0a0e27;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-right: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.4);
}

/* Calculation Result */
.calculation-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1) 0%, rgba(100, 255, 218, 0.08) 100%);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: var(--radius-md);
}

.calculation-result h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.calc-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: rgba(10, 14, 39, 0.5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
}

.calc-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.calc-item.highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: #0a0e27;
}

.calc-item.highlight .calc-label,
.calc-item.highlight .calc-value {
    color: #0a0e27;
}

.calc-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.calc-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0a0e27;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(10, 14, 39, 0.5);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(10, 14, 39, 0.8);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-tertiary {
    background: linear-gradient(135deg, var(--success-color), #00c853);
    color: #0a0e27;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-tertiary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.5);
}

.btn-tertiary:active {
    transform: translateY(0);
}

.btn svg {
    flex-shrink: 0;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid rgba(0, 217, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    .title {
        font-size: 1.875rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .header {
        padding: 2rem 1.5rem;
    }

    .form-container {
        padding: 1.5rem;
    }

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

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

    .actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-tertiary {
        order: 1;
    }
    
    .btn-secondary {
        order: 2;
    }
    
    .btn-primary {
        order: 0;
    }
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Selection color */
::selection {
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

/* PDF Template Styles */
.pdf-document {
    width: 210mm;
    padding: 8mm 10mm;
    background: white;
    font-family: 'Noto Sans TC', sans-serif;
    color: #000;
    box-sizing: border-box;
    font-size: 11px;
}

.pdf-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
    page-break-after: avoid;
}

.pdf-title-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pdf-title {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.pdf-subtitle {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.pdf-date {
    font-size: 11px;
    color: #666;
    text-align: right;
}

.pdf-section {
    margin-bottom: 10px;
    page-break-inside: avoid;
}

.pdf-section.page-break {
    page-break-before: always;
}

.pdf-section.highlight {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1.5px solid #333;
    page-break-inside: avoid;
}

.pdf-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    margin-bottom: 6px;
    padding-bottom: 3px;
    border-bottom: 1.5px solid #666;
    page-break-after: avoid;
}

.pdf-row {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
}

.pdf-field {
    flex: 1;
    font-size: 12px;
    line-height: 1.6;
}

.pdf-field.full {
    flex: 1 1 100%;
}

.pdf-field strong {
    font-weight: 600;
    margin-right: 6px;
}

.pdf-id-card-image {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-align: center;
}

.pdf-id-card-image img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pdf-id-cards-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.pdf-id-cards-row .pdf-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pdf-id-cards-row .pdf-field strong {
    display: block;
    margin-bottom: 5px;
}

.pdf-checkbox {
    margin-right: 5px;
    font-size: 12px;
    font-weight: 700;
}

.pdf-description {
    font-size: 11px;
    line-height: 1.5;
    margin-bottom: 6px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.pdf-note {
    font-size: 10px;
    line-height: 1.4;
    color: #555;
    background: #fffbeb;
    padding: 6px 8px;
    border-radius: 4px;
    margin-top: 5px;
    border-left: 2px solid #fbbf24;
}

.pdf-amounts {
    font-size: 12px;
}

.pdf-amount-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #e5e7eb;
}

.pdf-amount-row.total {
    font-size: 13px;
    font-weight: 700;
    background: #f3f4f6;
    padding: 8px;
    border-radius: 4px;
    border: none;
    margin-top: 4px;
}

.pdf-signature {
    display: flex;
    gap: 30px;
    margin-top: 12px;
    margin-bottom: 15px;
    page-break-inside: avoid;
}

.signature-box {
    flex: 1;
}

.signature-label {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 5px;
}

.signature-line {
    font-size: 12px;
    padding-top: 20px;
    text-align: center;
}

.pdf-footer {
    text-align: right;
    font-size: 9px;
    color: #999;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dotted #e5e7eb;
    page-break-inside: avoid;
}

.pdf-footer p {
    margin: 4px 0;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 10px;
    }
}

