/* Custom styles for HTR application */

.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: none;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    padding: 2rem;
    text-align: center;
}

.login-body {
    padding: 2rem;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.dashboard-container {
    background-color: #f8f9fa;
    min-height: calc(100vh - 76px);
    padding: 2rem 0;
}

.navbar-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.navbar-custom .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.card-stat {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.card-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-success { background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%); }
.stat-info { background: linear-gradient(135deg, #3ca55c 0%, #b5fffc 100%); }
.stat-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }

.study-card {
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.study-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

/* Page-specific styles */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-title {
    color: #495057;
    font-weight: 600;
}

/* Form improvements */
.form-label {
    font-weight: 500;
    color: #495057;
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background-color: #667eea;
    border-color: #667eea;
}

/* Table improvements */
.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem 0;
    }
    
    .card-stat {
        margin-bottom: 1rem;
    }
}

/* Alert improvements */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

/* Expandable Row Styles for Scan Details */
.expandable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.expandable-row:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.scan-details-cell {
    text-align: center;
    vertical-align: middle;
}

.scan-expand-btn {
    min-width: 100px;
    border: none;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.scan-expand-btn:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.scan-expand-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.scan-expand-btn.expanded {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.scan-expand-btn.expanded:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
}

.scan-expand-btn.invalid {
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.scan-expand-btn.invalid:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.scan-expand-btn.invalid:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.scan-expand-btn i {
    margin-right: 4px;
    transition: transform 0.3s ease;
}

.scan-expand-btn.expanded i {
    transform: rotate(180deg);
}

.scan-details-row {
    display: none;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
}

.scan-details-row.show {
    display: table-row;
    animation: slideDown 0.3s ease-out;
}

.scan-details-content {
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.scan-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.scan-metadata-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.scan-metadata-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.scan-metadata-value {
    color: #212529;
    font-size: 0.95rem;
}

.scan-viewer-container {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

.scan-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.scan-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 15px;
}

.scan-error {
    text-align: center;
    padding: 30px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

.scan-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.scan-static-image {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform-origin: center;
}

.scan-3d-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scan Details Layout - Same as original Details page */
.scan-details-layout {
    padding: 15px;
    margin: 10px 0;
}

.scan-viewer {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
    position: relative;
}

.scan-viewer h5 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
}

.static-image-container {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 800px;
    display: block;
}

.static-image-container > div {
    width: 100%;
    text-align: center;
}

.static-image-container h5 {
    margin-bottom: 20px !important;
    text-align: center;
}

.static-image {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 0 auto;
    display: block;
    transform-origin: center;
}

.static-image-container .text-center {
    margin-top: auto;
    margin-bottom: auto;
}

.image-loading-container {
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

.image-loading-container .text-center {
    margin: 0 auto;
}

.metadata-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    min-height: 400px;
}

.metadata-panel h5 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.metadata-item:last-child {
    border-bottom: none;
}

.metadata-label {
    font-weight: 600;
    color: #495057;
    flex: 1;
}

.metadata-value {
    font-weight: 500;
    color: #212529;
    text-align: right;
    flex: 1;
}

/* Placeholder EVW Styling */
.placeholder-evw-row {
    background-color: #fff3cd !important; /* Light yellow background */
    border-left: 4px solid #ffc107 !important; /* Yellow left border */
}

.placeholder-evw-row:hover {
    background-color: #ffe69c !important; /* Slightly darker yellow on hover */
}

/* Placeholder EVW warning icon */
.placeholder-evw-row .bi-exclamation-triangle-fill {
    color: #f57c00;
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* X3DOM container styling for inline viewer */
.scan-3d-container .x3d-container {
    width: 100%;
    height: 300px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #000;
    position: relative;
    overflow: hidden;
}

.scan-3d-container .x3d-container x3d {
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 6px;
}

.scan-3d-container .viewer-controls {
    margin-top: 15px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 5px;
    font-size: 0.9em;
    min-height: 120px; /* Ensure enough height for all controls */
}

.scan-3d-container .viewer-controls ul {
    margin-bottom: 10px;
    padding-left: 20px;
}

.scan-3d-container .viewer-controls li {
    margin-bottom: 3px;
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .scan-metadata {
        grid-template-columns: 1fr;
    }
    
    .scan-expand-btn {
        font-size: 0.8rem;
        padding: 4px 8px;
        min-width: 80px;
    }
    
    .scan-details-layout .col-lg-4 {
        margin-bottom: 20px;
    }
    
    .metadata-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .metadata-value {
        text-align: left;
        margin-top: 5px;
    }
    
    .scan-3d-container .x3d-container {
        height: 250px;
    }
    
    .scan-3d-container .viewer-controls {
        font-size: 0.8em;
        min-height: 140px; /* Slightly taller on mobile for better readability */
        padding: 12px;
    }
    
    .scan-3d-container .viewer-controls ul {
        padding-left: 15px;
    }
}