/* Odontograma FDI Styles */

.odontogram-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.odontogram-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.control-group h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d1d9e0;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
}

.info-panel {
    background: var(--background);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Odontograma */
.odontogram {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.odontogram-title {
    text-align: center;
    margin-bottom: 40px;
}

.odontogram-title h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.odontogram-title p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Odontograma en grid para alineación perfecta */
.odontogram-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.odontogram-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

/* Cuadrantes */
.quadrant-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: fit-content;
}

.quadrant-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 3px 6px;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.teeth-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Separador horizontal */
.horizontal-separator {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.horizontal-line {
    width: 100%;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    max-width: 80%;
}

/* Separador vertical */
.vertical-separator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    min-width: 30px;
    height: 80px;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.vertical-line {
    width: 2px;
    height: 50px;
    background: #999;
    border-radius: 1px;
}

/* Dientes */
.tooth {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.tooth:hover {
    transform: scale(1.05);
}

.tooth.selected {
    transform: scale(1.1);
}

/* Dientes de la página principal (no interactivos) */
.tooth.page-tooth {
    cursor: default;
    pointer-events: none;
}

.tooth.page-tooth:hover {
    transform: none;
}

.tooth.page-tooth.selected {
    transform: scale(1.05);
}

.tooth-number {
    font-weight: 600;
    font-size: 0.6rem;
    color: var(--text-primary);
    background: var(--background);
    padding: 2px 4px;
    border-radius: 6px;
    min-width: 14px;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.tooth.selected .tooth-number {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-light);
}

.tooth-shape {
    position: relative;
    width: 18px;
    height: 25px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.tooth.selected .tooth-shape {
    background: var(--primary-color);
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
}

.tooth-crown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 6px 6px 0 0;
    transition: all 0.3s ease;
}

.tooth.selected .tooth-crown {
    background: linear-gradient(to bottom, #3498db, #2980b9);
}

.tooth-roots {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 20px;
    display: flex;
    justify-content: center;
    gap: 2px;
    align-items: flex-end;
}

.root {
    width: 8px;
    background: #dee2e6;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
}

.tooth.selected .root {
    background: #2980b9;
}

/* Tipos de dientes */
.tooth-shape.incisor {
    width: 14px;
    height: 23px;
}

.tooth-shape.incisor .tooth-crown {
    height: 14px;
    border-radius: 2px 2px 0 0;
}

.tooth-shape.incisor .tooth-roots {
    height: 9px;
}

.tooth-shape.incisor .root {
    width: 4px;
}

.tooth-shape.canine {
    width: 16px;
    height: 28px;
}

.tooth-shape.canine .tooth-crown {
    height: 16px;
    border-radius: 2px 2px 0 0;
}

.tooth-shape.canine .tooth-roots {
    height: 12px;
}

.tooth-shape.canine .root {
    width: 5px;
}

.tooth-shape.premolar {
    width: 17px;
    height: 24px;
}

.tooth-shape.premolar .tooth-crown {
    height: 15px;
    border-radius: 2px 2px 0 0;
}

.tooth-shape.premolar .tooth-roots {
    height: 9px;
}

.tooth-shape.premolar .root {
    width: 4px;
}

.tooth-shape.molar {
    width: 19px;
    height: 26px;
}

.tooth-shape.molar .tooth-crown {
    height: 17px;
    border-radius: 2px 2px 0 0;
}

.tooth-shape.molar .tooth-roots {
    height: 9px;
}

.tooth-shape.molar .root {
    width: 3px;
}

/* Efectos de hover */
.tooth:hover .tooth-shape {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.2);
}

.tooth:hover .tooth-number {
    background: var(--primary-color);
    color: white;
}

/* Animaciones */
@keyframes selectPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.tooth.selecting {
    animation: selectPulse 0.3s ease-in-out;
}

/* Estados especiales */
.tooth.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tooth.disabled:hover {
    transform: none;
}

.tooth.highlighted {
    animation: selectPulse 0.6s ease-in-out infinite;
}

.tooth.highlighted .tooth-shape {
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(39, 174, 96, 0.4);
}

/* Tooltip */
.tooth::after {
    content: attr(data-fdi);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    z-index: 1000;
}

.tooth:hover::after {
    opacity: 1;
}

/* Modal de Odontograma */
.odontogram-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.odontogram-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.odontogram-modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 95vw;
    max-height: 90vh;
    overflow: auto;
    animation: slideUp 0.3s ease;
    position: relative;
}

.odontogram-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.odontogram-modal-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0;
}

.odontogram-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1;
}

.odontogram-modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.odontogram-modal-body {
    padding: 30px;
}

.odontogram-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    background: var(--background);
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.modal-selected-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
}

.modal-selected-info .info-badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.modal-footer-actions {
    display: flex;
    gap: 10px;
}

.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: var(--border);
    color: var(--text-primary);
}

.btn-modal-cancel:hover {
    background: #d1d9e0;
}

.btn-modal-apply {
    background: var(--primary-color);
    color: white;
}

.btn-modal-apply:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* Botón para abrir modal al lado del input */
.teeth-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.teeth-input-wrapper .table-input {
    flex: 1;
}

.btn-open-odontogram {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-open-odontogram:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-open-odontogram svg {
    width: 16px;
    height: 16px;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive */
@media (max-width: 1200px) {
    .odontogram-row {
        gap: 6px;
    }
    
    .vertical-separator {
        margin: 0 8px;
        min-width: 25px;
    }
}

/* Sección de Colores */
.colors-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: 100%;
}

.colors-list-container {
    max-height: 500px;
    overflow-y: auto;
}

.color-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 15px;
}

.color-item-teeth {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.color-item-color-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.colors-list-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 40px 20px;
}

/* Scrollbar para lista de colores */
.colors-list-container::-webkit-scrollbar {
    width: 6px;
}

.colors-list-container::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 10px;
}

.colors-list-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.colors-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

@media (max-width: 768px) {
    .odontogram-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .odontogram-modal-header,
    .odontogram-modal-footer {
        padding: 15px 20px;
    }
    
    .odontogram-modal-body {
        padding: 20px;
    }
    
    .modal-selected-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-footer-actions {
        width: 100%;
    }
    
    .btn-modal {
        flex: 1;
    }
    
    .odontogram-layout {
        flex-direction: column !important;
    }
    
    .odontogram-column,
    .colors-column {
        width: 100% !important;
        flex: 1 !important;
    }
    
    .colors-list-container {
        max-height: 300px;
    }
    
    .odontogram-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .quadrant-section {
        flex-direction: row;
        gap: 8px;
    }
    
    .quadrant-label {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        padding: 8px 3px;
        font-size: 0.6rem;
    }
    
    .vertical-separator {
        margin: 8px 0;
        min-width: auto;
        height: auto;
        width: 100%;
    }
    
    .vertical-line {
        width: 30px;
        height: 2px;
    }
    
    .teeth-row {
        gap: 3px;
    }
}

@media (max-width: 480px) {
    .teeth-row {
        gap: 2px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tooth-shape {
        width: 15px;
        height: 20px;
    }
    
    .tooth-shape.incisor {
        width: 12px;
        height: 18px;
    }
    
    .tooth-shape.canine {
        width: 14px;
        height: 22px;
    }
    
    .tooth-shape.premolar {
        width: 15px;
        height: 19px;
    }
    
    .tooth-shape.molar {
        width: 16px;
        height: 21px;
    }
    
    .tooth-number {
        font-size: 0.5rem;
        padding: 1px 2px;
        min-width: 12px;
    }
    
    .quadrant-label {
        font-size: 0.5rem;
        padding: 4px 2px;
    }
    
    .btn-open-odontogram {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* ============================================ */
/* MODAL DE ALERTAS Y CONFIRMACIONES */
/* ============================================ */

.custom-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.custom-modal-overlay.active {
    display: flex;
}

.custom-modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

.custom-modal-header {
    background: var(--primary-color);
    color: white;
    padding: 20px 25px;
    border-bottom: none;
}

.custom-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.custom-modal-body {
    padding: 30px 25px;
}

.custom-modal-message {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-line;
}

.custom-modal-footer {
    padding: 20px 25px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--background);
    border-top: 1px solid var(--border);
}

.custom-modal-footer .btn-primary,
.custom-modal-footer .btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-modal-footer .btn-primary {
    background: var(--primary-color);
    color: white;
}

.custom-modal-footer .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.custom-modal-footer .btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.custom-modal-footer .btn-secondary:hover {
    background: #bdc3c7;
}

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

