/**
 * GravitoChronos - Styles CSS
 * Interface de visualisation du systeme solaire 3D
 */

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000011;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Conteneur Three.js */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Overlay UI */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Header */
#header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(0, 0, 30, 0.8);
    padding: 15px 30px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#header h1 {
    font-size: 1.8em;
    font-weight: 300;
    color: #88aaff;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

#header p {
    font-size: 0.9em;
    color: #8899aa;
}

/* Panneaux lateraux */
aside {
    position: absolute;
    background: rgba(0, 0, 30, 0.85);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

aside h2 {
    font-size: 1em;
    font-weight: 500;
    color: #88aaff;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.3);
}

/* Panneau de controle */
#control-panel {
    top: 100px;
    left: 20px;
    width: 220px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    font-size: 0.85em;
    color: #aabbcc;
    margin-bottom: 5px;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(100, 150, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #5588ff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #77aaff;
}

.control-group span {
    display: block;
    font-size: 0.8em;
    color: #77aaff;
    margin-top: 3px;
    text-align: right;
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #5588ff;
}

#control-panel button {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    background: rgba(85, 136, 255, 0.2);
    border: 1px solid rgba(85, 136, 255, 0.5);
    border-radius: 5px;
    color: #88aaff;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s;
}

#control-panel button:hover {
    background: rgba(85, 136, 255, 0.4);
    border-color: rgba(85, 136, 255, 0.8);
}

#control-panel h3 {
    font-size: 0.85em;
    color: #6699cc;
    margin-top: 15px;
    margin-bottom: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(100, 150, 255, 0.2);
}

#control-panel select {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 40, 0.8);
    border: 1px solid rgba(85, 136, 255, 0.5);
    border-radius: 5px;
    color: #aabbcc;
    font-size: 0.85em;
    cursor: pointer;
}

#control-panel select:focus {
    outline: none;
    border-color: rgba(85, 136, 255, 0.8);
}

/* Panneau d'information */
#info-panel {
    top: 100px;
    right: 20px;
    width: 280px;
}

#simulation-time {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 50, 100, 0.3);
    border-radius: 5px;
}

#simulation-time p {
    font-size: 0.9em;
    margin-bottom: 5px;
}

#simulation-time span {
    color: #77aaff;
    font-weight: 500;
}

#selected-body-info {
    font-size: 0.9em;
}

#selected-body-info h3 {
    color: #ffaa55;
    margin-bottom: 8px;
}

#selected-body-info p {
    color: #aabbcc;
    margin-bottom: 10px;
    font-style: italic;
}

.info-table {
    width: 100%;
    font-size: 0.85em;
}

.info-table tr {
    border-bottom: 1px solid rgba(100, 150, 255, 0.1);
}

.info-table td {
    padding: 5px 0;
}

.info-table td:first-child {
    color: #8899aa;
}

.info-table td:last-child {
    color: #aaccff;
    text-align: right;
    font-family: 'Consolas', monospace;
}

/* Panneau de legende */
#legend-panel {
    bottom: 20px;
    left: 20px;
    width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Affichage de la formule */
#formula-display {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 30, 0.9);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 200, 100, 0.3);
}

#formula-display p {
    font-family: 'Times New Roman', serif;
    font-size: 1.3em;
    font-style: italic;
    color: #ffcc88;
    letter-spacing: 2px;
}

/* Labels des corps celestes */
#labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.body-label {
    position: absolute;
    transform: translate(-50%, -100%);
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.2s;
}

.body-label:hover {
    z-index: 100;
}

.label-name {
    background: rgba(0, 0, 40, 0.85);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    border: 1px solid rgba(100, 150, 255, 0.4);
    margin-bottom: 3px;
}

.label-time-info {
    background: rgba(30, 30, 60, 0.9);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    color: #aabbcc;
    border: 1px solid rgba(100, 150, 255, 0.2);
}

.time-factor, .time-offset {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
}

.factor-value, .offset-value {
    color: #77ddff;
    font-family: 'Consolas', monospace;
    margin-left: 8px;
}

/* Scrollbar personnalisee */
aside::-webkit-scrollbar {
    width: 6px;
}

aside::-webkit-scrollbar-track {
    background: rgba(0, 0, 30, 0.5);
    border-radius: 3px;
}

aside::-webkit-scrollbar-thumb {
    background: rgba(85, 136, 255, 0.5);
    border-radius: 3px;
}

aside::-webkit-scrollbar-thumb:hover {
    background: rgba(85, 136, 255, 0.8);
}

/* Responsive */
@media (max-width: 900px) {
    #header {
        padding: 10px 20px;
    }
    
    #header h1 {
        font-size: 1.3em;
    }
    
    #control-panel {
        width: 180px;
        font-size: 0.9em;
    }
    
    #info-panel {
        width: 220px;
    }
    
    #legend-panel {
        display: none;
    }
    
    #formula-display {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
    }
    
    #formula-display p {
        font-size: 1em;
    }
}

@media (max-width: 600px) {
    #control-panel, #info-panel {
        display: none;
    }
    
    #header {
        top: 10px;
        padding: 8px 15px;
    }
    
    #header h1 {
        font-size: 1.1em;
    }
    
    #header p {
        display: none;
    }
}

/* Bouton Settings */
#settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 30, 0.85);
    border: 1px solid rgba(100, 150, 255, 0.4);
    border-radius: 50%;
    color: #88aaff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

#settings-btn:hover {
    background: rgba(85, 136, 255, 0.3);
    border-color: rgba(100, 150, 255, 0.8);
    transform: rotate(45deg);
}

#settings-btn svg {
    width: 22px;
    height: 22px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 20, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(10, 15, 40, 0.98);
    border: 1px solid rgba(100, 150, 255, 0.4);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 30, 60, 0.5);
    border-bottom: 1px solid rgba(100, 150, 255, 0.3);
}

.modal-header h2 {
    color: #88aaff;
    font-size: 1.2em;
    font-weight: 400;
}

.modal-close {
    background: none;
    border: none;
    color: #8899aa;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ff6666;
}

.modal-body {
    padding: 0;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}

/* Onglets */
.tabs {
    display: flex;
    flex-wrap: wrap;
    background: rgba(0, 20, 40, 0.5);
    border-bottom: 1px solid rgba(100, 150, 255, 0.2);
    padding: 10px 10px 0;
    gap: 5px;
}

.tab-btn {
    background: rgba(50, 80, 120, 0.3);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 8px 14px;
    color: #8899aa;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(70, 100, 140, 0.4);
    color: #aabbcc;
}

.tab-btn.active {
    background: rgba(85, 136, 255, 0.2);
    border-color: rgba(100, 150, 255, 0.5);
    color: #88aaff;
}

/* Contenu des onglets */
.tab-content {
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    color: #ffaa55;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 170, 85, 0.3);
}

.tab-pane h4 {
    color: #77aaff;
    font-size: 0.95em;
    margin-top: 15px;
    margin-bottom: 10px;
}

.setting-group {
    margin-bottom: 10px;
}

.setting-group label {
    display: flex;
    align-items: center;
    color: #ccd0d5;
    font-size: 0.9em;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.setting-group label:hover {
    background: rgba(100, 150, 255, 0.1);
}

.setting-group input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #5588ff;
}

.no-moons {
    color: #666;
    font-style: italic;
    font-size: 0.85em;
    margin-top: 10px;
}

/* Scrollbar pour modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 30, 0.5);
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(85, 136, 255, 0.4);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(85, 136, 255, 0.6);
}

/* Panneau des horloges */
#clock-panel {
    position: absolute;
    bottom: 100px;
    right: 320px;
    width: 220px;
    background: rgba(0, 0, 30, 0.9);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    cursor: move;
    user-select: none;
    z-index: 50;
}

#clock-panel:hover {
    border-color: rgba(100, 150, 255, 0.6);
}

#clock-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

#clock-panel::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(100, 150, 255, 0.3);
    border-radius: 2px;
}

.clock-container {
    text-align: center;
    padding: 12px;
    background: rgba(0, 30, 60, 0.5);
    border-radius: 8px;
    margin-bottom: 10px;
}

.clock-container:last-child {
    margin-bottom: 0;
}

.clock-label {
    font-size: 0.75em;
    color: #8899aa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.clock-label span {
    color: #ffaa55;
}

.clock-display {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.8em;
    font-weight: 300;
    color: #55ffaa;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(85, 255, 170, 0.3);
}

.clock-planet .clock-display {
    color: #ffaa55;
    text-shadow: 0 0 10px rgba(255, 170, 85, 0.3);
}

.clock-date {
    font-size: 0.8em;
    color: #6688aa;
    margin-top: 3px;
}

.clock-offset {
    font-size: 0.75em;
    color: #77aaff;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(100, 150, 255, 0.2);
}

/* Styles pour l'onglet Horloge dans settings */
.setting-description {
    color: #8899aa;
    font-size: 0.85em;
    margin-bottom: 15px;
    line-height: 1.4;
}

#clock-planet {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 40, 0.8);
    border: 1px solid rgba(85, 136, 255, 0.5);
    border-radius: 5px;
    color: #aabbcc;
    font-size: 0.95em;
    cursor: pointer;
    margin-top: 5px;
}

#clock-planet:focus {
    outline: none;
    border-color: rgba(85, 136, 255, 0.8);
}

.clock-preview {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 30, 60, 0.4);
    border-radius: 6px;
    text-align: center;
}

.clock-preview p {
    color: #aabbcc;
    font-size: 0.9em;
}

.clock-preview span {
    color: #55ffaa;
    font-family: 'Consolas', monospace;
}

/* Styles pour l'onglet Graphique */
.graph-bodies {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.graph-bodies label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
}

#graph-type, #graph-unit, #graph-reference {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 40, 0.8);
    border: 1px solid rgba(85, 136, 255, 0.5);
    border-radius: 5px;
    color: #aabbcc;
    font-size: 0.9em;
    cursor: pointer;
    margin-top: 5px;
}

#graph-type:focus, #graph-unit:focus, #graph-reference:focus {
    outline: none;
    border-color: rgba(85, 136, 255, 0.8);
}

/* Panneau de graphique flottant */
#time-graph-panel {
    position: absolute;
    top: 100px;
    right: 20px;
    width: 400px;
    background: rgba(0, 10, 30, 0.92);
    border: 1px solid rgba(85, 136, 255, 0.4);
    border-radius: 10px;
    padding: 15px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: none;
}

#time-graph-panel.visible {
    display: block;
}

#time-graph-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(85, 136, 255, 0.3);
    cursor: move;
}

#time-graph-panel .panel-title {
    font-size: 1em;
    color: #aaccff;
    font-weight: 500;
}

#time-graph-panel .panel-close {
    background: none;
    border: none;
    color: #667;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0 5px;
}

#time-graph-panel .panel-close:hover {
    color: #ff6666;
}

/* Canvas du graphique */
#time-graph-canvas {
    width: 100%;
    height: 250px;
    background: rgba(0, 5, 20, 0.6);
    border-radius: 6px;
}

/* Legende du graphique */
.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.75em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.graph-info {
    margin-top: 10px;
    padding: 8px;
    background: rgba(0, 30, 60, 0.4);
    border-radius: 4px;
    font-size: 0.8em;
    color: #8899aa;
    text-align: center;
}

.graph-info strong {
    color: #aabbcc;
}
