/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --purple-color: #9C27B0;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-dark: #212529;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--purple-color) 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--white);
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header__icon {
    font-size: 2rem;
    margin-right: 0.5rem;
}

.header__subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

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

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

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

.card__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Form styles */
.form__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form__group {
    display: flex;
    flex-direction: column;
}

.form__label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form__input {
    padding: 0.75rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form__input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form__input.error {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form__input.success {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.btn__icon {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    color: var(--white);
}

.btn--primary:hover {
    background: linear-gradient(135deg, #1976D2, var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn--secondary {
    background: linear-gradient(135deg, var(--dark-gray), #5a6268);
    color: var(--white);
}

.btn--secondary:hover {
    background: linear-gradient(135deg, #5a6268, var(--dark-gray));
    transform: translateY(-2px);
}

.btn--success {
    background: linear-gradient(135deg, var(--success-color), #388E3C);
    color: var(--white);
}

.btn--success:hover {
    background: linear-gradient(135deg, #388E3C, var(--success-color));
    transform: translateY(-2px);
}

.btn--info {
    background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
    color: var(--white);
}

.btn--info:hover {
    background: linear-gradient(135deg, var(--purple-color), var(--primary-color));
    transform: translateY(-2px);
}

.btn--warning {
    background: linear-gradient(135deg, var(--warning-color), #F57C00);
    color: var(--text-dark);
}

.btn--danger {
    background: linear-gradient(135deg, var(--danger-color), #D32F2F);
    color: var(--white);
}

.form__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Results section */
.results {
    display: grid;
    gap: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.result-item--overdue {
    background: #ffebee;
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

.result-item--total {
    background: linear-gradient(135deg, var(--success-color), #388E3C);
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
}

.result-label {
    font-weight: 600;
}

.result-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* DARF Preview */
.darf-preview {
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
    background: var(--white);
    font-family: 'Courier New', monospace;
    margin-bottom: 1rem;
}

.darf-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

.darf-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.darf-subtitle {
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.darf-content {
    display: grid;
    gap: 1rem;
}

.darf-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--medium-gray);
}

.darf-label {
    font-weight: bold;
    color: var(--text-dark);
}

.darf-value {
    color: var(--primary-color);
    font-weight: 600;
}

.darf-value--overdue {
    color: var(--danger-color);
    font-weight: bold;
}

.darf-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* FAQ Section */
.faq__item {
    border-bottom: 1px solid var(--medium-gray);
}

.faq__question {
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq__question:hover {
    background: var(--light-gray);
    color: var(--primary-color);
}

.faq__icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: var(--transition);
}

.faq__question.active .faq__icon {
    transform: rotate(45deg);
}

.faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--light-gray);
}

.faq__answer.active {
    max-height: 200px;
}

.faq__answer p {
    padding: 1rem;
    margin: 0;
    color: var(--dark-gray);
    line-height: 1.6;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: var(--white);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding: 2rem 0 1rem;
    text-align: center;
    color: var(--white);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer__content {
    max-width: 800px;
    margin: 0 auto;
}

.footer__text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.footer__link {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.footer__link:hover {
    color: var(--warning-color);
    text-decoration: underline;
}

.footer__disclaimer {
    font-size: 0.8rem;
    opacity: 0.8;
    font-style: italic;
}

/* Error messages */
.error-message {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* Success messages */
.success-message {
    background: var(--success-color);
    color: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header__title {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .form__row {
        grid-template-columns: 1fr;
    }
    
    .form__actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .darf-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .darf-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.8rem;
    }
    
    .header__subtitle {
        font-size: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card__title {
        font-size: 1.3rem;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header, .form-section, .faq-section, .footer {
        display: none;
    }
    
    .darf-preview {
        border: 2px solid black;
        box-shadow: none;
    }
    
    .darf-actions {
        display: none;
    }
}

/* Accessibility improvements */
.btn:focus,
.form__input:focus,
.faq__question:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
