/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    background: linear-gradient(to bottom right, #f8fafc, #eff6ff, #f8fafc);
    color: #0f172a;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 2rem 2rem;
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background: #2563eb;
    border-radius: 1rem;
    margin-bottom: 1rem;
    color: white;
}

.header-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.header-subtitle {
    font-size: 1.125rem;
    color: #475569;
}

/* Content */
.content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Section */
.section {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-icon {
    color: #2563eb;
    flex-shrink: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
}

.section-description {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 1.5rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.5rem;
}

.required {
    color: #ef4444;
}

.optional {
    color: #64748b;
    font-weight: 400;
    font-size: 0.875rem;
}

.file-count {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* Form Inputs */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px #2563eb;
}

.form-select {
    cursor: pointer;
}

.form-textarea {
    resize: none;
    font-family: inherit;
}

/* Period Wrapper */
.period-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.period-icon {
    color: #94a3b8;
    margin-top: 2rem;
    flex-shrink: 0;
}

.period-inputs {
    flex: 1;
}

.period-selects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

/* Drop Zone */
.drop-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #60a5fa;
    background: #f8fafc;
}

.drop-zone.drag-active {
    border-color: #2563eb;
    background: #eff6ff;
}

.drop-zone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input:disabled {
    cursor: not-allowed;
}

.upload-icon {
    color: #94a3b8;
    margin: 0 auto 1rem;
}

.upload-text {
    color: #334155;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: #64748b;
}

/* File Upload Zone */
.file-upload-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload-zone:hover {
    border-color: #60a5fa;
    background: #f8fafc;
}

.file-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.file-display.has-file {
    flex-direction: row;
    justify-content: center;
}

.file-display svg {
    color: #94a3b8;
}

.file-display.has-file svg {
    color: #16a34a;
}

.file-upload-text {
    font-size: 0.875rem;
    color: #475569;
}

.file-name {
    font-size: 0.875rem;
    color: #334155;
}

/* Files List */
.files-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.file-item-icon {
    color: #2563eb;
    flex-shrink: 0;
}

.file-item-name {
    font-size: 0.875rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}

.file-item-size {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

.file-item-remove {
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.file-item-remove:hover {
    color: #dc2626;
}

/* Action Section */
.action-wrapper {
    max-width: 42rem;
    margin: 0 auto;
}

.progress-container {
    margin-bottom: 1.5rem;
}

.progress-container.hidden {
    display: none;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.progress-percent {
    font-size: 0.875rem;
    font-weight: 500;
    color: #2563eb;
}

.progress-bar {
    width: 100%;
    background: #e2e8f0;
    border-radius: 9999px;
    height: 0.75rem;
    overflow: hidden;
}

.progress-bar-fill {
    background: linear-gradient(to right, #3b82f6, #2563eb);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease-out;
    width: 0%;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* Mobile: stack action buttons vertically */
@media (max-width: 640px) {
    .button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn {
        width: 100%;
        flex: none;
        padding: 0.9rem 1rem;
        font-size: 1rem;
        white-space: normal;
    }
}

/* Base Action Button Style */
.action-btn {
    flex: 1;
    color: white;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.action-btn:hover:not(:disabled) {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.hidden {
    display: none;
}

/* Reset Button - Red */
.btn-reset {
    background: linear-gradient(to right, #ef4444, #dc2626);
}

.btn-reset:hover:not(:disabled) {
    background: linear-gradient(to right, #dc2626, #b91c1c);
}

/* Generate Button - Dark Blue */
.btn-generate {
    background: linear-gradient(to right, #2563eb, #1d4ed8);
}

.btn-generate:hover:not(:disabled) {
    background: linear-gradient(to right, #1d4ed8, #1e40af);
}

/* Download Button - Green */
.btn-download {
    background: linear-gradient(to right, #10b981, #059669);
}

.btn-download:hover:not(:disabled) {
    background: linear-gradient(to right, #059669, #047857);
}

.btn-icon {
    width: 24px;
    height: 24px;
}

.btn-icon.spinning {
    animation: spin 1s linear infinite;
}

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

/* Warning Box */
.warning-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 0.5rem;
}

.warning-box p {
    font-size: 0.875rem;
    color: #92400e;
    text-align: center;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    animation: slideIn 0.3s ease-out;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: #22c55e;
    color: white;
}

.toast.error {
    background: #ef4444;
    color: white;
}

.toast.warning {
    background: #eaa208;
    color: white;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-weight: 500;
}



