/* css/etapas.css - Estilos da página de Gestão de Etapas */
/* Mobile First Design */

/* ===== CONTAINER PRINCIPAL ===== */
.etapas-management-wrapper {
    min-height: calc(100vh - 80px);
    padding: 100px 16px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== HEADER DA PÁGINA ===== */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 20px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-3px);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #a0a0a0;
    margin: 4px 0 0;
}

/* ===== BOTÕES ===== */
.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ALERTAS ===== */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== FILTROS ===== */
.filters-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.search-box {
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    color: #ffffff;
    transition: all 0.3s;
}

.search-box input::placeholder {
    color: #888;
}

.search-box input:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn,
.filter-btn-tipo {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.filter-btn:hover,
.filter-btn-tipo:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.filter-btn.active,
.filter-btn-tipo.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border-color: transparent;
}

/* ===== CARDS DE ETAPAS ===== */
.etapas-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.etapa-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.3s;
}

.etapa-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.etapa-card.past {
    opacity: 0.6;
}

.etapa-card.today {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Header do Card com Tipo */
.card-type-header {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.etapa-number {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
}

.etapa-tipo {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-type-header,
.card-type-header span {
    color: white;
}

/* Tipos de Etapa */
.type-regular {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.type-superpole {
    background: linear-gradient(135deg, #eab308, #ca8a04);
}

.type-grid-invertido {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.type-endurance {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.type-tbd {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Corpo do Card */
.card-body {
    padding: 16px;
    display: flex;
    gap: 16px;
}

/* Bloco de Data */
.etapa-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.etapa-date-block .weekday {
    font-size: 9px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.etapa-date-block .day {
    font-size: 28px;
    font-weight: 800;
    color: #6366f1;
    line-height: 1;
}

.etapa-date-block .month {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
}

.etapa-date-block .year {
    font-size: 10px;
    color: #666;
}

/* Informações da Etapa */
.etapa-info {
    flex: 1;
    min-width: 0;
}

.etapa-nome {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px;
    line-height: 1.3;
}

.etapa-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #a0a0a0;
}

.detail-icon {
    font-size: 12px;
    width: 18px;
    text-align: center;
}

.kartodromo-link {
    color: #a0a0a0;
    text-decoration: none;
    transition: color 0.3s;
    border-bottom: 1px dotted rgba(160, 160, 160, 0.5);
}

.kartodromo-link:hover {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

/* Sponsor */
.etapa-sponsor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sponsor-logo {
    max-height: 30px;
    max-width: 100%;
    object-fit: contain;
    filter: brightness(0.9);
    transition: all 0.3s;
}

.sponsor-link:hover .sponsor-logo {
    filter: brightness(1.2);
    transform: scale(1.05);
}

/* Badges */
.etapa-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.badge-categoria {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-today {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

.badge-past {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Ações do Card */
.card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: flex-end;
}

.btn-action {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-view {
    background: rgba(59, 130, 246, 0.2);
}

.btn-view:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

.btn-edit {
    background: rgba(245, 158, 11, 0.2);
}

.btn-edit:hover {
    background: rgba(245, 158, 11, 0.4);
    transform: scale(1.1);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

/* ===== ESTADO VAZIO ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #ffffff;
    margin: 0 0 8px;
}

.empty-state p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #1a1a2e;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.modal-large {
    max-width: 600px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #1a1a2e;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #ffffff;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 18px;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    transform: rotate(90deg);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: #1a1a2e;
}

/* ===== FORMULÁRIO ===== */
.form-group {
    padding: 0 24px;
    margin-bottom: 16px;
}

.form-group:first-of-type {
    margin-top: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #e0e0e0;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    color: #ffffff;
    transition: all 0.3s;
}

.form-group input::placeholder {
    color: #666;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.form-group select option {
    background: #1a1a2e;
    color: #ffffff;
}

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

.form-row .form-group {
    margin-bottom: 16px;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
}

.check-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500 !important;
}

.check-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* ===== VISUALIZAÇÃO ===== */
.view-content {
    padding: 24px;
}

.view-etapa-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.view-header-card {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.view-tipo {
    font-size: 16px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.view-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    color: #888;
    font-size: 13px;
    font-weight: 600;
}

.info-row span {
    color: #e0e0e0;
    font-size: 14px;
    text-align: right;
}

/* ===== ANIMAÇÕES ===== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===== RESPONSIVO - TABLET ===== */
@media (min-width: 640px) {
    .etapas-management-wrapper {
        padding: 110px 24px 40px;
    }

    .page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .page-title {
        font-size: 2rem;
    }

    .filters-container {
        padding: 20px;
    }

    .etapas-cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .form-row .form-group {
        padding-left: 24px;
        padding-right: 12px;
    }

    .form-row .form-group:last-child {
        padding-left: 12px;
        padding-right: 24px;
    }
}

/* ===== RESPONSIVO - DESKTOP ===== */
@media (min-width: 1024px) {
    .etapas-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .etapa-nome {
        font-size: 1.1rem;
    }
}

/* ===== RESPONSIVO - DESKTOP GRANDE ===== */
@media (min-width: 1280px) {
    .etapas-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}