/* ============================================================================
   FACIAL TRAINING REGISTRATION - DARK THEME WITH MINIMAL GREEN
   ✅ UPDATED: Fixed validation feedback to prevent layout shifts
   ✅ UPDATED: Added warning button style for Skip Training
   Subtle gray/blue primary, green for success/active states only
   ============================================================================ */

   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #ffffff;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/student/static/assets/design/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: -2;
}

/* Dark overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Dark overlay */
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================================================
   BACK BUTTON STYLING
   ============================================================================ */

.back-button-container {
    margin-bottom: 1rem;
}

.btn-back {
    background-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.btn-back:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btn-back:active {
    transform: translateY(0);
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    color: #28a745;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
}

.header p {
    color: #9ca3af;
    font-size: 1rem;
}

/* ============================================================================
   WIZARD STEPS - GRAY, NOT GREEN
   ============================================================================ */

   .wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Change these rgba values to be MORE transparent (lower alpha) */
    background: linear-gradient(135deg, rgba(30, 32, 36, 0.7) 0%, rgba(35, 37, 42, 0.7) 100%);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid rgba(58, 58, 58, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 10px;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 35px;
    right: -37%;
    width: 73%;
    height: 2px;
    background: #4b5563;
    z-index: 0;
}

.step.active:not(:last-child)::after {
    background: #6b7280;
}

.step.completed:not(:last-child)::after {
    background: #28a745;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(107, 114, 128, 0.2);
    border: 2px solid #4b5563;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
    font-size: 18px;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

.step.active .step-number {
    background: rgba(107, 114, 128, 0.4);
    border-color: #6b7280;
    color: #e5e7eb;
    transform: scale(1.1);
}

.step.completed .step-number {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.step-title {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.step.active .step-title {
    color: #d1d5db;
    font-weight: 600;
}

.step.completed .step-title {
    color: #9ca3af;
}

/* ============================================================================
   CONTENT AREA - FIXED: Prevent height jumping
   ============================================================================ */

   .wizard-content {
    /* Change these rgba values to be MORE transparent (lower alpha) */
    background: linear-gradient(135deg, rgba(30, 32, 36, 0.7) 0%, rgba(35, 37, 42, 0.7) 100%);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(58, 58, 58, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
    min-height: 650px;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* ============================================================================
   FORM STYLES
   ============================================================================ */

.step-heading {
    margin-bottom: 30px;
    font-size: 1.5rem;
    color: #e5e7eb;
    font-weight: 600;
}

.step-content#step2 .step-heading {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #d1d5db;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ✅ Label hints styling */
label small {
    font-weight: normal;
    color: #666;
}

/* ============================================================================
   ✅ NEW: INFO ICON TOOLTIP SYSTEM (NO LAYOUT SHIFT)
   ============================================================================ */

.field-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(23, 162, 184, 0.2);
    color: #17a2b8;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.field-info:hover {
    background: rgba(23, 162, 184, 0.3);
    transform: scale(1.1);
}

.field-info-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e2024;
    border: 1px solid #17a2b8;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 250px;
    max-width: 300px;
    font-size: 0.875rem;
    font-weight: normal;
    color: #d1d5db;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.field-info-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #17a2b8;
}

.field-info:hover .field-info-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 15px);
}

.field-info-tooltip ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.field-info-tooltip li {
    margin: 4px 0;
}

.field-info-tooltip strong {
    color: #17a2b8;
    display: block;
    margin-bottom: 6px;
}

.form-help-text {
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: block;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(107, 114, 128, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

/* ✅ File input specific styling */
.form-group input[type="file"] {
    padding: 0.6rem 0.875rem;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-group input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: rgba(107, 114, 128, 0.5);
    background: rgba(255, 255, 255, 0.07);
}

/* FOCUS - GREEN (active/success state) */
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.form-group input::placeholder {
    color: #6b7280;
}

.form-group select {
    appearance: auto;
    cursor: pointer;
}

/* ✅ NEW: Fix dropdown options visibility */
.form-group select option {
    background: #1e2024;
    color: #ffffff;
    padding: 10px;
}

/* Style for disabled/placeholder option */
.form-group select option:disabled {
    color: #6b7280;
}

/* Hover state for options (some browsers support this) */
.form-group select option:hover {
    background: #28a745;
    color: #ffffff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ============================================================================
   ✅ VALIDATION STATE - BORDER COLORS ONLY (NO LAYOUT SHIFT)
   ============================================================================ */

/* Input border colors based on validation state */
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Validation states */
input.validating,
select.validating {
    border-color: #17a2b8 !important;
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1) !important;
}

input.valid,
select.valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

input.invalid,
select.invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

input.warning,
select.warning {
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1) !important;
}

/* ✅ Student ID specific styling */
#student-id {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#student-id::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    letter-spacing: normal;
}

/* ============================================================================
   CAMERA SECTION
   ============================================================================ */

.camera-section {
    text-align: center;
}

.camera-container {
    position: relative;
    max-width: 640px;
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 2px solid #4b5563;
}

#webcam-video {
    display: none;
    width: 100%;
    transform: scaleX(-1);
}

#preview-canvas {
    width: 100%;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    color: white;
    text-align: center;
    font-size: 0.9rem;
}

/* ============================================================================
   TRAINING PROGRESS
   ============================================================================ */

.training-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: rgba(107, 114, 128, 0.2);
    border: 1px solid #4b5563;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #218838);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    width: 0%;
}

/* ============================================================================
   TRAINING VISUAL
   ============================================================================ */

.training-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.progress-circle {
    position: relative;
    width: 200px;
    height: 200px;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: rgba(107, 114, 128, 0.2);
    stroke-width: 12;
}

.progress-circle .progress-fill {
    fill: none;
    stroke: #28a745;
    stroke-width: 12;
    stroke-dasharray: 565; /* 2 * π * 90 */
    stroke-dashoffset: 565;
    transition: stroke-dashoffset 0.3s ease;
    stroke-linecap: round;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.photo-count {
    font-size: 48px;
    font-weight: bold;
    color: #28a745;
    display: block;
}

.photo-total {
    font-size: 20px;
    color: #9ca3af;
}

/* Recent captures preview */
.recent-captures {
    display: flex;
    gap: 10px;
}

.capture-slot {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: rgba(107, 114, 128, 0.2);
    border: 2px solid #4b5563;
    background-size: cover;
    background-position: center;
}

.capture-slot.captured {
    border-color: #28a745;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn-group-navigation {
    margin-top: 40px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

/* PRIMARY - GREEN (success action) */
.btn-primary {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* SECONDARY - GRAY */
.btn-secondary {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: rgba(107, 114, 128, 0.35);
    border-color: #6b7280;
}

/* ✅ NEW: WARNING BUTTON - For Skip Training */
.btn-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 2px solid rgba(255, 193, 7, 0.4);
}

.btn-warning:hover {
    background: rgba(255, 193, 7, 0.25);
    border-color: #ffc107;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
}

.btn-warning:active {
    transform: translateY(0);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

#stop-training-btn {
    display: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #5cb85c;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #f5c6cb;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.alert-info {
    background: rgba(107, 114, 128, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #28a745;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   REVIEW SECTION
   ============================================================================ */

.review-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #4b5563;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.review-section h3 {
    margin-bottom: 15px;
    color: #e5e7eb;
    font-size: 1.1rem;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #4b5563;
}

.review-item:last-child {
    border-bottom: none;
}

.review-label {
    font-weight: 500;
    color: #9ca3af;
}

.review-value {
    color: #e5e7eb;
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .wizard-steps {
        padding: 20px 10px;
    }
    
    .step-title {
        font-size: 12px;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .wizard-content {
        padding: 1.5rem;
        min-height: 550px; /* ✅ Adjust for mobile */
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .btn-back {
        width: 100%;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 0.88rem;
    }
    
    .wizard-steps {
        padding: 15px 5px;
    }
    
    .step {
        padding: 5px;
    }
    
    .step-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .step-title {
        font-size: 10px;
    }
    
    .wizard-content {
        padding: 1.25rem;
        min-height: 500px; /* ✅ Adjust for smaller mobile */
    }
    
    .step-heading {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .photo-thumbnail {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 360px) {
    .header h1 {
        font-size: 1.3rem;
    }
    
    .wizard-content {
        padding: 1rem;
        min-height: 450px; /* ✅ Adjust for very small screens */
    }
    
    .step-heading {
        font-size: 1.1rem;
    }
}

/* Landscape on short screens */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 0.75rem 0.5rem;
    }
    
    .header {
        margin-bottom: 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .wizard-steps {
        padding: 15px;
        margin-bottom: 1rem;
    }
    
    .wizard-content {
        padding: 1rem;
        min-height: 400px;
    }
    
    .camera-container {
        max-height: 300px;
    }
}

/* ============================================================================
   MODAL STYLES - FOR SKIP TRAINING CONFIRMATION
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
}

.modal-container {
    background: linear-gradient(135deg, rgba(30, 32, 36, 0.98) 0%, rgba(35, 37, 42, 0.98) 100%);
    border: 2px solid rgba(255, 193, 7, 0.3);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(107, 114, 128, 0.3);
}

.modal-header h2 {
    margin: 0;
    color: #ffc107;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    margin: 0 0 1rem 0;
    color: #d1d5db;
    line-height: 1.6;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body p strong {
    color: #e5e7eb;
    font-weight: 600;
}

.modal-footer {
    padding: 1rem 2rem 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 120px;
}

/* Mobile responsiveness for modal */
@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        max-width: none;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        padding: 1rem 1.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        min-width: auto;
    }
}