* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
}

.screen {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    min-width: 300px;
}

.form-group {
    margin-bottom: 0.75rem;
    text-align: center;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #4fc3f7;
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.3);
}

button {
    background: linear-gradient(45deg, #4fc3f7, #29b6f6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 195, 247, 0.4);
}

.error-message {
    color: #f44336;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Main Application */
#mainApp {
    flex-direction: column;
    height: 100vh;
}







/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    gap: 2rem;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.sidebar .model-selector {
    margin-bottom: 1.5rem;
}

.sidebar .model-selector label {
    display: block;
    color: #4fc3f7;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.sidebar .model-selector select {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
}

.sidebar .model-selector select option {
    background: #1a1a2e;
    color: #ffffff;
}

.sidebar h3 {
    color: #4fc3f7;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.views-list {
    margin-bottom: 1rem;
}

.view-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.view-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(79, 195, 247, 0.3);
}

.view-item.active {
    background: rgba(79, 195, 247, 0.2);
    border-color: #4fc3f7;
}

.view-item h4 {
    color: #ffffff;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.view-item p {
    color: #b0bec5;
    font-size: 0.8rem;
}

.add-view-btn {
    width: 100%;
    background: linear-gradient(45deg, #4caf50, #388e3c);
    padding: 0.75rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.sidebar .export-btn {
    background: linear-gradient(45deg, #4caf50, #388e3c);
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.sidebar .logout-btn {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    margin-top: auto;
}

/* Right Content */
.right-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
}

.inspect-section h4 {
    color: #4fc3f7;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}



.test-btn {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
    font-size: 0.9rem;
    min-width: auto;
}

.view-config {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.config-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.console-link-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.skin-search-group {
    flex: 1;
    position: relative;
}

.skin-search-group label {
    display: block;
    color: #4fc3f7;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.skin-search-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: left;
}

.skin-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.skin-result-item {
    padding: 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.skin-result-item:hover {
    background: rgba(79, 195, 247, 0.2);
}

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

.console-link-group {
    flex: 1;
}

.console-link-group label {
    display: block;
    color: #4fc3f7;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.console-link-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: left;
}

.config-form .form-group label {
    color: #4fc3f7;
    font-size: 1.2rem;
}

.config-form .form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: left;
}

.delete-btn {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    min-width: auto;
}

.save-btn {
    background: linear-gradient(45deg, #4caf50, #388e3c);
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

.update-btn, .save-btn {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
    font-size: 0.9rem;
    min-width: auto;
}

.save-new-btn {
    background: linear-gradient(45deg, #2196f3, #1976d2);
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
    font-size: 0.9rem;
    min-width: auto;
}

.control-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 4px;
    justify-content: space-between;
}

.header-row {
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: nowrap;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-row {
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: flex-end;
}

.save-new-row {
    justify-content: flex-start;
    margin-bottom: 0;
}

.header-group {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.angle-headers {
    display: flex;
    gap: 0.25rem;
    min-width: 180px;
    justify-content: center;
}

.position-headers {
    display: flex;
    gap: 0.25rem;
    min-width: 180px;
    justify-content: center;
}

.distance-header {
    min-width: 60px;
    justify-content: center;
}

.header-group:nth-child(4) { min-width: 120px; } /* View - 1 input * 120px */
.header-group:nth-child(5) { min-width: 120px; } /* Actions - buttons width */

/* Table Layout */
.control-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.control-table th {
    color: #64b5f6;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    padding: 0.5rem 0.25rem;
    background: transparent;
    border-bottom: none;
}

.control-table td {
    padding: 0.25rem;
    text-align: center;
    vertical-align: middle;
}

/* Column Widths */
.angle-header, .angle-cell { width: 72px; } /* 60px + 20% = 72px */
.position-header, .position-cell { width: 78px; } /* 60px + 30% = 78px */
.distance-header, .distance-cell { width: 72px; } /* Same as angle boxes */
.view-header, .view-cell { width: 120px; }
.actions-header, .actions-cell { width: 160px; } /* Wider for 3 buttons */
.test-header, .test-cell { width: 80px; }

/* Input Styling in Table */
.control-table input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: center;
    height: auto;
    box-sizing: border-box;
}

.control-table .action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.angle-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.angle-inputs {
    display: flex;
    gap: 0.25rem;
    align-items: flex-end;
}

.position-inputs {
    display: flex;
    gap: 0.25rem;
    align-items: flex-end;
}

.distance-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.view-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.actions-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-label {
    font-size: 10px;
    font-weight: 600;
    color: #b0bec5;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.view-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.view-input {
    width: 120px; /* Double width of other inputs (60px * 2) */
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: center;
    height: auto !important; /* Match distance box height */
    box-sizing: border-box;
}

.view-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Hide number input arrows for angle and position inputs */
#angleX::-webkit-outer-spin-button,
#angleX::-webkit-inner-spin-button,
#angleY::-webkit-outer-spin-button,
#angleY::-webkit-inner-spin-button,
#angleZ::-webkit-outer-spin-button,
#angleZ::-webkit-inner-spin-button,
#posX::-webkit-outer-spin-button,
#posX::-webkit-inner-spin-button,
#posY::-webkit-outer-spin-button,
#posY::-webkit-inner-spin-button,
#posZ::-webkit-outer-spin-button,
#posZ::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#angleX[type=number],
#angleY[type=number],
#angleZ[type=number],
#posX[type=number],
#posY[type=number],
#posZ[type=number] {
    -moz-appearance: textfield;
}

.position-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.position-symbol {
    font-size: 0.75rem;
    font-weight: 600;
    color: #b0bec5;
    text-align: center;
    min-width: 1rem;
}

.angle-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.angle-symbol {
    font-size: 1.2rem;
    color: #4fc3f7;
    font-weight: bold;
    text-align: center;
    width: 60px;
}

.angle-input-group input,
.position-input-group input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: center;
}

.angle-inputs input {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: center;
    width: 60px;
    height: 48px;
}

.angle-inputs input::-webkit-outer-spin-button,
.angle-inputs input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.angle-inputs input[type="number"] {
    -moz-appearance: textfield;
}

.distance-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.distance-input {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: center;
    width: 72px;
    height: auto;
}

.distance-input::-webkit-outer-spin-button,
.distance-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.distance-input[type="number"] {
    -moz-appearance: textfield;
}

.name-save-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.name-input {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-size: 1rem;
    text-align: left;
    width: 150px;
}



.test-results {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}



.test-history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.test-result-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.test-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.test-result-settings {
    color: #b0bec5;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.test-result-crop {
    font-size: 0.85rem;
    color: #4fc3f7;
    margin-bottom: 0.5rem;
    padding: 2px 6px;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 4px;
    border-left: 3px solid #4fc3f7;
}

/* Crop Settings Display in Setup Area */
.crop-settings-display {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(79, 195, 247, 0.05);
    border: 1px solid rgba(79, 195, 247, 0.2);
    border-radius: 4px;
    font-size: 0.85rem;
}

.crop-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
    color: #4fc3f7;
}

.crop-settings-info {
    color: #b0bec5;
    font-family: 'Courier New', monospace;
    flex: 1;
}

.crop-remove-btn {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #f44336;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
}

.crop-remove-btn:hover {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.5);
}

.test-result-image {
    text-align: center;
}

.test-result-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.test-result-timestamp {
    color: #b0bec5;
    font-size: 0.8rem;
}

/* Crop Overlay Styles */
.test-result-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.crop-btn, .download-btn {
    background: rgba(79, 195, 247, 0.2);
    border: 1px solid #4fc3f7;
    color: #4fc3f7;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.crop-btn:hover, .download-btn:hover {
    background: rgba(79, 195, 247, 0.3);
    transform: translateY(-1px);
}

.crop-btn.active {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
    color: #4caf50;
}

.test-result-image-container {
    position: relative;
    display: inline-block;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    cursor: crosshair;
}

.test-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-selection {
    position: absolute;
    border: 2px solid #4fc3f7;
    background: transparent;
    display: none;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
    backdrop-filter: blur(1px);
}

.crop-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.crop-selection::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: transparent;
    pointer-events: none;
    border: 2px solid #4fc3f7;
    border-radius: 2px;
}

.crop-handles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #4fc3f7;
    border: 2px solid #ffffff;
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.crop-handle:hover {
    background: #29b6f6;
    transform: scale(1.2);
}

.crop-handle-nw {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

.crop-info {
    position: absolute;
    top: -30px;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
}

.crop-coords, .crop-size {
    display: block;
    margin: 0.1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 1rem;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .menu-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .inspect-input, .config-form {
        flex-direction: column;
    }
}
