/* Variables del selector */
:root {
    --period-green: #1a7504;
    --period-green-light: #22a005;
    --period-green-dark: #145a03;
    --period-green-bg: #f0f9f4;
}

/* === ESTILOS DEL SELECTOR === */

.period-selector-container {
    position: relative;
    display: inline-block;
}

.period-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--period-green);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(26, 117, 4, 0.2);
}

.period-btn:hover {
    background: var(--period-green-light);
    box-shadow: 0 3px 6px rgba(26, 117, 4, 0.3);
    transform: translateY(-1px);
}

.period-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.period-btn-text {
    flex: 1;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

.period-btn-arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.period-btn.active .period-btn-arrow {
    transform: rotate(180deg);
}

.period-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    max-width: 95vw;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(26, 117, 4, 0.12),
    0 0 0 1px rgba(26, 117, 4, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
}

.period-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.period-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    /*border-bottom: 2px solid var(--period-green);*/
    /*background: linear-gradient(to bottom, #ffffff, #fafbfa);*/
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

.period-dropdown-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--period-green-dark);
    letter-spacing: 0.5px;
}

.period-title-icon {
    width: 20px;
    height: 20px;
    color: var(--period-green);
}

.period-close-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.period-close-btn:hover {
    background: var(--period-green-bg);
    color: var(--period-green);
}

.period-close-btn svg {
    width: 18px;
    height: 18px;
}

.period-search {
    position: relative;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.period-search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
}

.period-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #1f2937;
    transition: all 0.2s ease;
}

.period-search-input:focus {
    outline: none;
    border-color: var(--period-green);
    box-shadow: 0 0 0 3px rgba(26, 117, 4, 0.1);
}

.period-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.period-list::-webkit-scrollbar {
    width: 6px;
}

.period-list::-webkit-scrollbar-track {
    background: #f9fafb;
}

.period-list::-webkit-scrollbar-thumb {
    background: #c1d9c5;
    border-radius: 3px;
}

.period-group {
    margin-bottom: 4px;
}

.period-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-group-icon {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
}

.period-group:first-child .period-group-icon {
    color: var(--period-green);
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.period-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.period-item:hover {
    background: #f9fafb;
}

.period-item.active {
    background: var(--period-green-bg);
    border-left-color: var(--period-green);
}

.period-item-icon,
.period-item-check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.period-item.active .period-item-check {
    color: var(--period-green);
}

.period-item-info {
    flex: 1;
    min-width: 0;
}

.period-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
}

.period-item.active .period-item-name {
    font-weight: 600;
    color: var(--period-green-dark);
}

.period-item-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: var(--period-green);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.period-dropdown-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafbfa;
    font-size: 12px;
    color: #6b7280;
}

.period-footer-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--period-green);
}

.period-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 999;
}

.period-overlay.show {
    opacity: 1;
    visibility: visible;
}

.period-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.period-no-results svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
    margin-bottom: 12px;
}


@media(max-width: 600px) {
    .period-dropdown {
        width: 100vw;
        border-radius: 0;
        top: calc(100% + 4px);
        right: -90px;
    }

    /* Reglas para el botón */
    .period-btn {
        /* Convierte el botón en un flex container para centrar el icono */
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px 10px; /* Ajusta el padding para un botón más compacto */
    }

    .period-btn-text {
        /* Oculta el nombre del período */
        display: none;
    }

    .period-btn-icon {
        /* Elimina el margen derecho si el texto está oculto */
        margin-right: 0;
    }
}