/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    overflow: hidden;
    color: #444;
}

/* ===== LAYOUT ===== */
.container {
    display: flex;
    height: 100vh;
}

/* ===== LEFT PANEL ===== */
.left-panel {
    width: 280px;
    background-color: #f5f5f5;
    padding: 15px;
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.left-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

/* Scrollbar Styling */
.left-panel-content::-webkit-scrollbar {
    width: 6px;
}
.left-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.left-panel-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
.left-panel-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== SHAPE OPTIONS ===== */
.shape-option-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.shape-option-box {
    width: 100px;
    height: 100px;
    border: 2px dashed #a8e6cf;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background-color: #ffffff;
    transition: all 0.2s ease;
}
.shape-option-box.selected {
    border: 2px solid #66bb6a;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.shape-option {
    padding: 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
}
.shape-option.square {
    width: 80px;
    height: 80px;
    background-color: #fff;
    border: 2px solid #9370db;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shape-option.circle {
    width: 80px;
    height: 80px;
    background-color: #fff;
    border: 2px solid #98fb98;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== ARROW OPTIONS ===== */
.arrow-option-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.arrow-option-box {
    width: 100px;
    height: 60px;
    border: 2px dashed #a8e6cf;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background-color: #ffffff;
    transition: all 0.2s ease;
}
.arrow-option-box.selected {
    border: 2px solid #66bb6a;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.arrow-option {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chemical-arrow {
    color: #ffb6c1;
    font-weight: bold;
}
.electrochemical-arrow {
    color: #add8e6;
    font-weight: bold;
}

.step-label {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 5px;
}

/* ===== BOARD FUNCTIONS ===== */
.board-functions-box {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #ddd;
}

.board-functions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.board-func-btn {
    background-color: #66bb6a;
    color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    transition: 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 0 auto;
    justify-content: center;
    min-width: 80px;
}
.board-func-btn i { font-size: 14px; }
.board-func-btn:hover { background-color: #4caf50; }

.board-func-btn.clear-btn {
    background: #ffe6e6;
    border-color: #f5a3a3;
    color: #d32f2f;
}
.board-func-btn.clear-btn:hover {
    background: #ffd0d0;
    border-color: #e57373;
}

.board-func-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* ===== BUTTONS ===== */
.build-button, .mode-button, .clear-button, .random-button {
    padding: 10px;
    background-color: #66bb6a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.build-button:hover, .mode-button:hover,
.clear-button:hover, .random-button:hover {
    background-color: #4caf50;
}
.build-button:disabled, .mode-button:disabled,
.clear-button:disabled, .random-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-container {
    display: flex;
    align-items: center;
    margin-top: 15px;
    gap: 10px;
}

.toggle-label { font-weight: bold; }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #66bb6a;
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1;
    position: relative;
    background-image: 
        linear-gradient(#ccc 1px, transparent 1px),
        linear-gradient(90deg, #ccc 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
}

/* ===== SHAPES ===== */
.shape {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: move;
    user-select: none;
    z-index: 10;
}
.shape.selected {
    outline: 2px solid #66bb6a;
}
.shape.square {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #9370db;
}
.shape.circle {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #98fb98;
    border-radius: 50%;
}

.shape-label {
    margin-top: 5px;
    font-size: 12px;
    text-align: center;
    max-width: 100px;
    color: #444;
}

.shape-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.shape-concentration {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
    text-align: center;
}

/* ===== ARROWS ===== */
.arrow {
    position: absolute;
    z-index: 5;
}

.arrow-path {
    fill: none;
    stroke-width: 3;
    pointer-events: stroke;
}
.arrow.selected .arrow-path {
    stroke-width: 4;
}

.chemical-arrow-path {
    stroke: #ffb6c1;
}
.electrochemical-arrow-path {
    stroke: #add8e6;
}

.arrow-hitbox {
    fill: none;
    stroke: transparent;
    stroke-width: 20;
    pointer-events: stroke;
}

.arrow-midpoint {
    fill: #66bb6a;
    stroke: #fff;
    stroke-width: 2;
    r: 6;
    display: none;
}
.arrow.selected .arrow-midpoint {
    display: block;
}

/* ===== RIGHT PANEL ===== */
.right-panel {
    width: 300px;
    background-color: #f5f5f5;
    padding: 15px;
    border-left: 1px solid #ccc;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.close-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #444;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #444;
}

input, select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #444;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
.slider-value {
    min-width: 20px;
    text-align: center;
}

/* ===== GRAPH VISUALIZATION ===== */
#graph-visualization {
    min-width: 300px;
    min-height: 300px;
}
#graph-visualization:active {
    cursor: move;
}
#graph-visualization img {
    transition: transform 0.2s ease;
}
#graph-visualization:hover img {
    transform: scale(1.02);
}

/* ===== SELECT CURSOR ===== */
.select-cursor {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 2px solid #66bb6a;
    transition: all 0.2s ease;
}
.select-cursor.active {
    background-color: #66bb6a;
    color: white;
}
.select-cursor i {
    font-size: 20px;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== MODEL SELECTION ===== */
.model-dropdown {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    color: #444;
}
.model-dropdown:focus {
    outline: none;
    border-color: #66bb6a;
    box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.2);
}

/* ===== COMSOL PARAMETERS ===== */
.comsol-params {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #ddd;
}
.comsol-params h4 {
    margin-bottom: 10px;
    color: #444;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.comsol-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.comsol-input-group label {
    min-width: 120px;
    margin-bottom: 0;
}
.comsol-input-group input {
    flex: 1;
}

/* ===== EXPERIMENTAL DATA ===== */
.experimental-data-section {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #ddd;
}
.experimental-data-section h4 {
    margin-bottom: 10px;
    color: #444;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.experimental-data-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 10px;
}

/* ===== BUG REPORT MODAL ===== */
#bug-report-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#bug-report-modal > div {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

#bug-report-modal h3 {
    margin: 0 0 20px 0;
    color: #444;
    border-bottom: 2px solid #ff6b6b;
    padding-bottom: 10px;
}

#bug-report-modal .form-group {
    margin-bottom: 15px;
}

#bug-report-modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #444;
}

#bug-report-modal textarea,
#bug-report-modal input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

#bug-report-modal textarea {
    resize: vertical;
    min-height: 100px;
}

#bug-report-modal button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

#bug-report-modal #close-bug-modal {
    background: none;
    font-size: 24px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bug-report-modal #close-bug-modal:hover {
    background-color: #f0f0f0;
    border-radius: 50%;
}

#bug-report-modal #cancel-bug-report {
    background-color: #ccc;
    color: #444;
}
#bug-report-modal #cancel-bug-report:hover {
    background-color: #bbb;
}

#bug-report-modal #submit-bug-report {
    background-color: #ff6b6b;
    color: white;
}
#bug-report-modal #submit-bug-report:hover {
    background-color: #ff5252;
}
#bug-report-modal #submit-bug-report i {
    margin-right: 8px;
}