/**
 * Earnings Components Styles - Improved Layout
 * Pure CSS with modern grid layout for better usability
 */

/* ===== TIER CARD LAYOUT ===== */
.tier-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.tier-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tier-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.tier-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tier-card-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background-color: #3b82f6;
    color: #ffffff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

.tier-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .tier-card-body {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ===== TIER SECTIONS ===== */
.tier-section {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tier-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.tier-section-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tier-condition {
    background-color: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tier-payment {
    background-color: #ecfdf5;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #b2dac8;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ===== TIER ROW (Legacy - mantido para compatibilidade) ===== */
.tier-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
}

.tier-row-compact {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
}

@media (max-width: 1024px) {
    .tier-row-compact {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* ===== INPUT STYLES ===== */
.tier-input {
    width: 8rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    transition: all 0.15s;
}

.tier-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

.tier-input:disabled,
.tier-input.input-disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    color: #9ca3af;
}

.tier-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== LABEL STYLES ===== */
.tier-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.tier-label-inline {
    font-size: 1rem;
    color: #4b5563;
    font-weight: 500;
}

.tier-title,
.tier-percentage {
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 500;
}

.tier-text {
    font-size: 0.875rem;
    color: #374151;
}

/* ===== BADGE STYLES ===== */
.badge-field {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1f2937;
    background-color: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    white-space: nowrap;
}

.badge-field.badge-highlight {
    background-color: rgba(234, 179, 8, 0.25);
    border-color: #ca8a04;
    font-weight: 600;
}

.badge-field-sm {
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
}

/* Dark mode support for badges */
@media (prefers-color-scheme: dark) {
    .badge-field {
        background-color: rgba(234, 179, 8, 0.2);
        border-color: rgba(234, 179, 8, 0.4);
        color: #fbbf24;
    }
}

/* ===== SYMBOL STYLES ===== */
.comparison-symbol {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0.25rem;
}

/* ===== BUTTON STYLES ===== */
.btn-add-tier {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background-color: #3b82f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add-tier:hover:not(:disabled) {
    background-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-add-tier:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #9ca3af;
}

.btn-add-tier:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.btn-delete-tier {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    color: #ef4444;
    background-color: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-delete-tier:hover {
    color: #dc2626;
    background-color: #fef2f2;
}

.btn-delete-tier:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.btn-delete-tier svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ===== CONTAINER STYLES ===== */
.tier-container, .earning-container {
    margin-top: 1rem;
    background-color: #f9fafb;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.tier-container-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.tier-container-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* ===== ACCORDION STYLES ===== */
.accordion-item {
    margin-top: 1rem;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0rem 0.5rem 0rem 0.5rem;
}

.accordion-label {
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    margin-left: -35px;
    margin-bottom: 0;
}

.accordion-label:hover {
    background-color: #e5e7eb;
}

.accordion-label:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.accordion-label.active {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #3b82f6;
}

.accordion-body {
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    margin: 0 1.3rem 0 00.5rem;
}

/* ===== HELP/INFO STYLES ===== */
.help-tooltip-icon {
    width: 1.125rem;
    height: 1.125rem;
    color: #9ca3af;
    cursor: help;
    margin-left: 0.375rem;
    transition: color 0.15s;
}

.help-tooltip-icon:hover {
    color: #6b7280;
}

.help-tooltip {
    max-width: 300px;
}

/* ===== UTILITY CLASSES ===== */
.tier-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 1rem 0;
}

.tier-spacer {
    height: 1rem;
}

.tier-highlight {
    background-color: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding-left: 0.75rem;
}

.earnings input {
    max-width: 110px;
}

.earnings input,
.earnings input::placeholder {
    font-size: .875rem;
    line-height: 1.5715;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .tier-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .tier-input {
        width: 100%;
        max-width: 100%;
    }

    .tier-input-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .tier-card-body {
        grid-template-columns: 1fr;
    }

    .btn-add-tier {
        width: 100%;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tier-card {
    animation: slideIn 0.2s ease-out;
}

/* ===== PRINT STYLES ===== */
@media print {
    .btn-delete-tier,
    .btn-add-tier {
        display: none;
    }

    .tier-card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}
