/* ===========================================
   ADD STUDENT - COMPACT MOBILE UI
   Version: 1.0.0
   Goals: 30-40% less vertical space, faster upload flow
   =========================================== */

/* ============================================
   MOBILE COMPACT STYLES (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

  /* ==========================================
     1. COMPACT HEADER - Remove redundancy
     ========================================== */
  .page-header {
    padding: 12px 0;
    margin-bottom: 12px;
  }

  .page-title {
    display: none; /* Hide redundant "Add New Student" */
  }

  .page-subtitle {
    font-size: 13px;
    color: var(--form-text-muted);
    margin: 0;
    text-align: center;
  }

  /* Simplified subtitle text */
  .page-subtitle::before {
    content: 'Educational documents can be added later';
    display: block;
  }

  .page-subtitle {
    font-size: 0; /* Hide original text */
  }

  .page-subtitle::before {
    font-size: 13px;
  }

  /* ==========================================
     2. COMPACT STEP INDICATOR
     ========================================== */
  .step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--form-surface);
    border-radius: 12px;
  }

  .step {
    flex-direction: row;
    gap: 0;
    padding: 0;
    min-width: auto;
  }

  .step span {
    display: none; /* Hide step labels on mobile */
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1;
  }

  /* Step connector line */
  .step:not(:last-child)::after {
    content: '';
    width: 32px;
    height: 2px;
    background: var(--form-border);
    margin: 0 8px;
    border-radius: 1px;
  }

  .step.completed:not(:last-child)::after {
    background: var(--form-success);
  }

  .step.active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--form-primary) 0%, var(--form-border) 100%);
  }

  /* Current step label - show only active */
  .step-indicator::after {
    content: attr(data-step-label);
    display: block;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--form-text-secondary);
    white-space: nowrap;
  }

  /* Step label container */
  .step-label-mobile {
    display: block;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--form-text-secondary);
    margin-top: 8px;
  }

  /* ==========================================
     3. COMPACT UPLOAD SECTION
     ========================================== */
  .form-card {
    padding: 16px;
    border-radius: 12px;
  }

  .section-title {
    font-size: 16px;
    margin-bottom: 12px;
    text-align: center;
  }

  /* Compact Upload Area - 40% smaller */
  .upload-area {
    min-height: 120px;
    max-height: 140px;
    padding: 20px 16px;
    border-width: 1.5px;
    border-radius: 12px;
    gap: 8px;
  }

  .upload-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
  }

  .upload-text {
    font-size: 15px;
    font-weight: 500;
  }

  /* Shorter copy */
  .upload-text::before {
    content: 'Upload passport scan';
  }

  .upload-text {
    font-size: 0;
  }

  .upload-text::before {
    font-size: 15px;
    font-weight: 500;
    color: var(--form-text-primary);
  }

  .upload-subtext {
    font-size: 12px;
  }

  /* Shorter subtext */
  .upload-subtext::before {
    content: 'JPG, PNG, WebP • Max 10MB';
  }

  .upload-subtext {
    font-size: 0;
  }

  .upload-subtext::before {
    font-size: 12px;
    color: var(--form-text-muted);
  }

  /* Tap hint */
  .upload-area::after {
    content: 'Tap to browse';
    display: block;
    font-size: 11px;
    color: var(--form-primary);
    margin-top: 4px;
    font-weight: 500;
  }

  /* ==========================================
     4. UPLOAD STATES
     ========================================== */

  /* Uploading state */
  .upload-area.uploading {
    pointer-events: none;
    opacity: 0.8;
  }

  .upload-area.uploading .upload-icon {
    animation: pulse 1.5s infinite;
  }

  .upload-area.uploading::after {
    content: 'Uploading...';
    color: var(--form-primary);
  }

  /* Success state */
  .upload-area.success {
    border-color: var(--form-success);
    background: rgba(0, 135, 90, 0.05);
  }

  .upload-area.success .upload-icon svg {
    stroke: var(--form-success);
  }

  .upload-area.success::after {
    content: none;
  }

  /* Error state */
  .upload-area.error {
    border-color: var(--form-error);
    background: rgba(222, 53, 11, 0.05);
  }

  .upload-area.error::after {
    content: 'Upload failed. Tap to retry.';
    color: var(--form-error);
  }

  /* ==========================================
     5. COMPACT PREVIEW
     ========================================== */
  .preview-container {
    padding: 12px;
    background: var(--form-bg);
    border-radius: 10px;
    margin-top: 12px;
  }

  .preview-image {
    max-height: 120px;
    border-radius: 8px;
  }

  .file-info {
    font-size: 13px;
    margin: 8px 0;
    padding: 8px 12px;
    background: var(--form-surface);
    border-radius: 8px;
  }

  /* Compact file uploaded state */
  .file-uploaded {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--form-success-subtle, #E3FCEF);
    border: 1px solid rgba(0, 135, 90, 0.2);
    border-radius: 10px;
    margin-top: 12px;
  }

  .file-uploaded-icon {
    width: 36px;
    height: 36px;
    background: var(--form-success);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
  }

  .file-uploaded-info {
    flex: 1;
    min-width: 0;
  }

  .file-uploaded-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--form-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .file-uploaded-size {
    font-size: 12px;
    color: var(--form-text-muted);
  }

  .file-uploaded-replace {
    font-size: 13px;
    color: var(--form-primary);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-weight: 500;
  }

  /* ==========================================
     6. FORM-SPECIFIC NAVIGATION
     ========================================== */
  .button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--form-border-light);
  }

  .button-group .btn {
    flex: 1;
    min-height: 48px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
  }

  .button-group .btn-secondary {
    flex: 0 0 auto;
    padding: 12px 24px;
    background: var(--form-bg);
    color: var(--form-text-secondary);
    border: 1px solid var(--form-border);
  }

  .button-group .btn-success {
    flex: 1;
  }

  .button-group .btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* Hide mobile bottom nav during form */
  .mobile-bottom-nav {
    display: none !important;
  }

  /* Form action bar (fixed bottom) */
  .form-actions-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--form-surface);
    border-top: 1px solid var(--form-border);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex;
    gap: 12px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  }

  .form-actions-mobile .btn {
    flex: 1;
    min-height: 48px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
  }

  .form-actions-mobile .btn-back {
    flex: 0 0 auto;
    padding: 12px 20px;
    background: var(--form-bg);
    color: var(--form-text-secondary);
    border: 1px solid var(--form-border);
  }

  .form-actions-mobile .btn-continue {
    flex: 1;
    background: linear-gradient(135deg, var(--form-primary) 0%, var(--form-primary-dark) 100%);
    color: white;
    border: none;
  }

  .form-actions-mobile .btn-continue:disabled {
    opacity: 0.5;
    background: var(--form-border);
    cursor: not-allowed;
  }

  /* ==========================================
     7. REDUCED PADDING & SPACING
     ========================================== */
  .main-content {
    padding: 12px;
    padding-bottom: 80px; /* Space for fixed action bar */
  }

  .section {
    margin-bottom: 0;
  }

  /* ==========================================
     8. OPTION CARDS - COMPACT
     ========================================== */
  .options-grid {
    gap: 10px;
  }

  .option-card {
    padding: 14px;
    border-radius: 10px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-align: left;
  }

  .option-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .option-title {
    font-size: 15px;
    margin-bottom: 2px;
  }

  .option-description {
    font-size: 12px;
  }

  /* ==========================================
     9. PROGRAM CARDS - COMPACT
     ========================================== */
  .program-card {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .program-name {
    font-size: 14px;
  }

  .program-details {
    font-size: 12px;
    margin-top: 4px;
  }

  /* ==========================================
     10. FORM FIELDS - COMPACT
     ========================================== */
  .form-grid {
    gap: 12px;
  }

  .form-group {
    margin-bottom: 0;
  }

  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .form-input,
  .form-select {
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 10px;
    min-height: 46px;
  }

  .field-status {
    font-size: 11px;
    margin-top: 4px;
  }

  /* ==========================================
     11. CAMERA SCAN BUTTON (Mobile Enhancement)
     ========================================== */
  .camera-scan-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: var(--form-bg);
    border: 1px dashed var(--form-border);
    border-radius: 10px;
    color: var(--form-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
  }

  .camera-scan-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
  }

  .camera-scan-btn:active {
    background: var(--form-border-light);
  }

  /* ==========================================
     12. STEP PROGRESS BAR (Alternative)
     ========================================== */
  .step-progress-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--form-surface);
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .step-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--form-border);
    border-radius: 2px;
    overflow: hidden;
  }

  .step-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--form-primary) 0%, var(--form-primary-light) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
  }

  .step-progress-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--form-text-secondary);
    white-space: nowrap;
  }
}

/* ============================================
   EXTRA SMALL MOBILE (< 480px)
   ============================================ */
@media (max-width: 480px) {
  .main-content {
    padding: 10px;
    padding-bottom: 76px;
  }

  .form-card {
    padding: 14px;
    border-radius: 10px;
  }

  .section-title {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .upload-area {
    min-height: 110px;
    max-height: 130px;
    padding: 16px 14px;
  }

  .upload-icon {
    width: 36px;
    height: 36px;
  }

  .step-number {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .step:not(:last-child)::after {
    width: 24px;
    margin: 0 6px;
  }

  .button-group .btn,
  .form-actions-mobile .btn {
    min-height: 46px;
    font-size: 14px;
  }

  .option-card {
    padding: 12px;
  }

  .option-icon {
    width: 36px;
    height: 36px;
  }

  .option-title {
    font-size: 14px;
  }
}

/* ============================================
   TINY MOBILE (< 360px)
   ============================================ */
@media (max-width: 360px) {
  .main-content {
    padding: 8px;
    padding-bottom: 72px;
  }

  .form-card {
    padding: 12px;
  }

  .upload-area {
    min-height: 100px;
    padding: 14px 12px;
  }

  .upload-icon {
    width: 32px;
    height: 32px;
  }

  .step:not(:last-child)::after {
    width: 20px;
    margin: 0 4px;
  }

  .step-number {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes uploadSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.upload-area.success {
  animation: uploadSuccess 0.3s ease;
}
