/**
 * Annotation Builder Stylesheet
 * Professional styling for the annotation builder interface
 */

/* Main Layout */
.annotation-builder-page {
    min-height: calc(100vh - 60px);
    background: #f5f7fa;
    padding: 0;
}

.page-header {
    background: #fff;
    border-bottom: 1px solid #e0e6ed;
    padding: 20px 30px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.page-header p {
    margin: 5px 0 0;
    color: #7f8fa4;
}

/* Three Column Layout */
.annotation-builder-layout {
    display: flex;
    height: calc(100vh - 160px);
    gap: 15px;
    padding: 0 20px 20px;
}

.sidebar-left {
    width: 280px;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-right {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Panels */
.panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e6ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.panel-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Canvas Container */
.canvas-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.canvas-toolbar {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e6ed;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
}

.toolbar-group {
    display: flex;
    gap: 5px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 5px;
}

.annotation-canvas-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #f5f7fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.annotation-canvas,
.annotation-overlay {
    background: #fff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.canvas-status-bar {
    padding: 10px 15px;
    border-top: 1px solid #e0e6ed;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6c757d;
}

/* Samples List */
.samples-list {
    margin-top: 15px;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.sample-item {
    padding: 12px;
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.sample-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateX(2px);
}

.sample-item.active {
    background: #e7f3ff;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.15);
}

.sample-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 14px;
}

.sample-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

/* Field Properties Form */
#field-form .form-group {
    margin-bottom: 15px;
}

#field-form label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

#field-form .form-control {
    font-size: 14px;
    border-radius: 4px;
    border-color: #dee2e6;
}

#field-form .form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Template Summary */
.template-stats {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 15px 0;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: #007bff;
}

/* Buttons */
.btn {
    border-radius: 4px;
    font-size: 14px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.btn-success:hover {
    background: #218838;
    border-color: #218838;
}

.btn-default {
    background: #fff;
    color: #495057;
    border-color: #dee2e6;
}

.btn-default:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.btn-default.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Tool Buttons */
.tool-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.tool-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.tool-btn i {
    font-size: 16px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 3px;
}

.badge-secondary {
    background: #6c757d;
    color: #fff;
}

.badge-success {
    background: #28a745;
    color: #fff;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-info {
    background: #17a2b8;
    color: #fff;
}

/* Annotations on Canvas */
.annotation-box {
    position: absolute;
    border: 2px solid #007bff;
    background: rgba(0, 123, 255, 0.1);
    cursor: move;
    transition: all 0.2s ease;
}

.annotation-box:hover {
    background: rgba(0, 123, 255, 0.2);
    border-color: #0056b3;
}

.annotation-box.selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.15);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* Field Type Colors */
.annotation-text {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.annotation-number {
    border-color: #6610f2;
    background: rgba(102, 16, 242, 0.1);
}

.annotation-date {
    border-color: #fd7e14;
    background: rgba(253, 126, 20, 0.1);
}

.annotation-currency {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.annotation-table {
    border-color: #17a2b8;
    background: rgba(23, 162, 184, 0.1);
}

.annotation-boolean {
    border-color: #e83e8c;
    background: rgba(232, 62, 140, 0.1);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd3da;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8b8c8;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1400px) {
    .sidebar-left {
        width: 240px;
    }
    
    .sidebar-right {
        width: 280px;
    }
}

@media (max-width: 1200px) {
    .annotation-builder-layout {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar-left,
    .sidebar-right {
        width: 100%;
        max-width: none;
    }
    
    .samples-list {
        max-height: 300px;
    }
    
    .main-content {
        min-height: 600px;
    }
}

/* Print Styles */
@media print {
    .sidebar-left,
    .sidebar-right,
    .canvas-toolbar,
    .canvas-status-bar {
        display: none;
    }
    
    .annotation-builder-layout {
        display: block;
    }
    
    .main-content {
        width: 100%;
    }
}