/* Estilos Gerais */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1, h2, h3, h4 {
    color: #2c3e50;
}

/* Layout Principal */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Tabs Navigation */
.tabs {
    display: flex;
    background-color: #34495e;
}

.tab-btn {
    padding: 15px 25px;
    border: none;
    background: none;
    color: #ecf0f1;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    flex: 1;
}

.tab-btn:hover {
    background-color: #2c3e50;
}

.tab-btn.active {
    background-color: #2980b9;
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Displays Container */
.displays-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.camera-container, .samples-container {
    position: relative;
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ecf0f1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.camera-container {
    height: 400px;
}

.samples-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.container-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10;
}

/* Camera e Canvas */
video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.camera-controls {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.capture-count {
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 15px;
}

/* Samples Section */
.samples-form {
    padding: 40px 15px 15px;
    background-color: #fff;
}

.samples-grid {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    background-color: #f9f9f9;
}

.samples-grid.hidden {
    display: none;
}

.sample-item {
    position: relative;
    height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.sample-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sample-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.class-selector {
    display: flex;
    margin: 15px 0;
    border-radius: 4px;
    overflow: hidden;
}

.class-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    background-color: #ecf0f1;
    cursor: pointer;
    transition: background-color 0.2s;
}

.class-btn:hover {
    background-color: #dfe6e9;
}

.class-btn.active {
    background-color: #3498db;
    color: white;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
    font-style: italic;
}

/* Instructions */
.instructions-panel {
    background-color: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.instructions-panel h3 {
    margin-bottom: 10px;
    color: #2980b9;
}

.instructions-panel ol {
    margin-left: 20px;
}

/* Training Tab */
.training-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.training-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.object-info {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.object-info .label {
    font-weight: bold;
    margin-right: 5px;
}

.training-options, .training-progress, .model-info {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-bar-container {
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: #2ecc71;
    transition: width 0.3s;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.model-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s;
}

.model-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.model-card h4 {
    margin-bottom: 8px;
    word-break: break-word;
}

.model-stats {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.model-actions {
    display: flex;
    justify-content: space-between;
}

/* Tracking Tab */
.tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tracking-display {
    margin-bottom: 20px;
}

.camera-container.large {
    height: 500px;
}

.tracking-info {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
}

.info-item .label {
    font-weight: bold;
    margin-right: 5px;
}

.tracking-controls {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="range"] {
    width: 200px;
    margin: 0 10px;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #2980b9;
}

.action-btn.primary-btn {
    background-color: #2ecc71;
}

.action-btn.primary-btn:hover {
    background-color: #27ae60;
}

.action-btn.small-btn {
    padding: 8px 15px;
    font-size: 14px;
}

.action-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.action-btn.danger-btn {
    background-color: #e74c3c;
}

.action-btn.danger-btn:hover {
    background-color: #c0392b;
}

.action-btn.icon-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Switch Toggle */
.switch-group {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: 10px;
}

.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: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Confirm Dialog */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.confirm-dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.confirm-dialog-header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #2c3e50;
}

.confirm-dialog-message {
    margin-bottom: 20px;
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-btn, .cancel-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.confirm-btn {
    background-color: #e74c3c;
    color: white;
}

.cancel-btn {
    background-color: #95a5a6;
    color: white;
}

/* Model Actions Toolbar */
.model-actions-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* Storage Info */
.storage-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #666;
}

/* Model Card Actions */
.model-card-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.model-download-link {
    text-decoration: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .displays-container {
        flex-direction: column;
    }
    
    .tracking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .model-selector {
        width: 100%;
    }
    
    .tracking-controls {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}