*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body{
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at bottom, #d9ff8a, #9ed63b);
  padding: 20px;
  min-height: 100vh;
}

/* ===== PAGE WRAPPER ===== */

.page{
  max-width: 820px;
  margin: auto;
}

/* ===== NAV BAR ===== */

.navbar{
  background: linear-gradient(45deg,#e91e63,#ff4081);
  color: white;
  padding: 16px 22px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.nav-title{
  font-size: 30px;
  font-weight: 700;
}

.nav-right{
  font-size: 14px;
  opacity: .9;
}

/* ===== URDU TEXT ===== */

.urdu-box{
  background: white;
  padding: 18px;
  border-radius: 14px;
  font-size: 18px;
  direction: rtl;
  text-align: right;
  margin-bottom: 20px;
  box-shadow: 0 6px 15px rgba(0,0,0,.15);
  line-height: 1.9;
}

/* ===== FORM CARD ===== */

.card{
  background: white;
  padding: 30px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  margin-bottom: 20px;
}

/* ===== INPUT ROW ===== */

.row{
  display: flex;
  gap: 14px;
}

/* ===== FORM GROUP ===== */

.form-group {
  margin-bottom: 15px;
  flex: 1;
}

/* ===== URDU LABELS ===== */

.urdu-label {
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Urdu Typesetting", "Segoe UI", Tahoma, sans-serif;
  color: #2c3e50;
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 5px;
  display: block;
  text-align: right;
  direction: rtl;
}

/* ===== INPUT STYLE ===== */

input,
textarea,
select{
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 15px;
  transition: 0.2s;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus{
  outline: none;
  border-color: #e91e63;
  box-shadow: 0 0 0 2px rgba(233,30,99,.2);
}

input.filled,
textarea.filled,
select.filled {
  border-color: #4CAF50;
  background-color: #f8f9fa;
}

textarea{
  resize: none;
  height: 95px;
}

.format-hint {
  color: #666;
  font-size: 12px;
  margin-top: 5px;
  display: block;
  text-align: right;
  direction: rtl;
}

/* ===== FORM SECTIONS ===== */

.form-section {
  margin-bottom: 25px;
}

.form-section h2 {
  color: #e91e63;
  margin-bottom: 15px;
  border-bottom: 2px solid #ff4081;
  padding-bottom: 8px;
  font-size: 22px;
}

.form-section h3 {
  color: #666;
  margin: 20px 0 15px 0;
  font-size: 18px;
}

/* ===== UPLOAD CONTAINER ===== */

.upload-container {
  background: #fff6fa;
  padding: 20px;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px solid #ffccd6;
}

.upload-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.upload-box{
  border: 2px dashed #e91e63;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  background: #fff6fa;
  transition: all 0.3s ease;
}

.upload-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(233, 30, 99, 0.2);
}

.upload-box label{
  font-weight: 600;
  font-size: 14px;
  display: block;
  margin-bottom: 5px;
  color: #333;
}

/* ===== IMAGE PREVIEW ===== */

.image-preview {
  margin-top: 10px;
  min-height: 120px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid #ddd;
  transition: all 0.3s ease;
}

.image-preview.empty {
  background: linear-gradient(45deg, #f5f5f5, #e0e0e0);
}

.image-preview img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
}

.preview-text {
  color: #666;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  padding: 10px;
}

/* ===== CAMERA BUTTON ===== */

.camera-btn {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 12px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  margin: 10px 0;
  width: 100%;
  transition: all 0.3s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.camera-btn:hover {
  background: #45a049;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

.camera-btn.captured {
  background: linear-gradient(45deg, #4CAF50, #8BC34A);
  box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

/* ===== BUTTONS ===== */

.primary{
  background: linear-gradient(45deg,#e91e63,#ff4081);
  border: none;
  padding: 15px;
  width: 100%;
  color: white;
  border-radius: 14px;
  font-size: 18px;
  margin-top: 24px;
  cursor: pointer;
  transition: 0.3s ease;
  box-shadow: 0 5px 15px rgba(233,30,99,.4);
  font-weight: bold;
  font-family: inherit;
}

.primary:hover{
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(233,30,99,.5);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.secondary {
  background: linear-gradient(45deg, #757575, #9e9e9e);
  border: none;
  padding: 15px;
  color: white;
  border-radius: 14px;
  font-size: 18px;
  cursor: pointer;
  transition: 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,.2);
  flex: 1;
  font-weight: bold;
  font-family: inherit;
}

.secondary:hover {
  transform: translateY(-2px);
  background: linear-gradient(45deg, #616161, #757575);
}

.button-row {
  display: flex;
  gap: 14px;
  margin-top: 24px;
}

/* ===== TAB SYSTEM ===== */

.tab {
  display: none;
}

.tab.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== PROGRESS BAR ===== */

.progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(45deg, #4CAF50, #8BC34A);
  width: 50%;
  transition: width 0.5s ease;
}

/* ===== CAMERA MODAL ===== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  width: 95%;
  max-width: 500px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: linear-gradient(45deg,#e91e63,#ff4081);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Segoe UI", sans-serif;
}

.close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  flex-shrink: 0;
}

.close-btn:hover {
  background: rgba(255,255,255,0.3);
}

.modal-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.video-container {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  min-height: 300px;
}

.video-container.portrait-mode {
  max-height: 400px;
}

.video-container.landscape-mode {
  max-height: 300px;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-video {
  max-width: 280px;
  max-height: 400px;
}

.landscape-video {
  max-width: 100%;
  max-height: 300px;
}

.camera-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #e91e63;
  border-radius: 8px;
  width: 80%;
  height: 80%;
  pointer-events: none;
  z-index: 1;
}

.camera-frame::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  animation: pulse 2s infinite;
}

.frame-text {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Segoe UI", sans-serif;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.camera-controls {
  text-align: center;
  margin: 20px 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-shrink: 0;
}

.capture-btn {
  background: linear-gradient(45deg, #4CAF50, #8BC34A);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.capture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.secondary-btn {
  background: linear-gradient(45deg, #2196F3, #03A9F4);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  font-family: inherit;
}

.secondary-btn:hover {
  background: linear-gradient(45deg, #1976D2, #0288D1);
  transform: translateY(-1px);
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  border-left: 4px solid #c62828;
  text-align: center;
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Segoe UI", sans-serif;
}

.orientation-guide {
  text-align: center;
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Segoe UI", sans-serif;
}

.portrait-guide {
  background: linear-gradient(45deg, #e8f5e9, #c8e6c9);
  color: #2e7d32;
  border: 1px solid #4CAF50;
}

.landscape-guide {
  background: linear-gradient(45deg, #e3f2fd, #bbdefb);
  color: #1976d2;
  border: 1px solid #2196F3;
}

.instruction-text {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-top: 10px;
  font-family: "Jameel Noori Nastaleeq", "Alvi Nastaleeq", "Segoe UI", sans-serif;
}

/* ===== SMALL TEXT ===== */

small {
  font-size: 12px;
  color: #666;
  display: block;
  margin-top: 3px;
  text-align: center;
  font-family: inherit;
}

/* ===== MOBILE RESPONSIVE ===== */

@media(max-width: 768px){
  .row{
    flex-direction: column;
  }
  
  .form-group {
    margin-bottom: 10px;
  }
  
  .upload-grid{
    grid-template-columns: 1fr;
  }
  
  .nav-title{
    font-size: 22px;
  }
  
  .card{
    padding: 22px;
  }
  
  .button-row {
    flex-direction: column;
  }
  
  .primary, .secondary {
    margin-top: 0;
  }
  
  .upload-box {
    padding: 12px;
  }
  
  .form-section h2 {
    font-size: 18px;
  }
  
  .form-section h3 {
    font-size: 16px;
  }
  
  .urdu-label {
    font-size: 14px;
  }
  
  .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    max-height: 100vh;
  }
  
  .camera-controls {
    flex-direction: column;
  }
  
  .capture-btn, .secondary-btn {
    width: 100%;
    justify-content: center;
  }
  
  .video-container.portrait-mode {
    max-height: 50vh;
  }
  
  .video-container.landscape-mode {
    max-height: 40vh;
  }
  
  .portrait-video {
    max-width: 100%;
    max-height: 50vh;
  }
  
  .landscape-video {
    max-width: 100%;
    max-height: 40vh;
  }
}

@media(max-width: 480px){
  body {
    padding: 10px;
  }
  
  .navbar {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .urdu-box {
    font-size: 16px;
    padding: 14px;
  }
  
  .primary, .secondary {
    padding: 12px;
    font-size: 16px;
  }
  
  .form-section h2 {
    font-size: 16px;
  }
  
  .modal-header h3 {
    font-size: 16px;
  }
  
  .camera-frame {
    width: 90%;
    height: 90%;
  }
}

/* ===== UTILITY CLASSES ===== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

/* ===== FONT FACE FOR URDU ===== */

@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('https://cdn.rawgit.com/linuxscout/urdufonts/0a5c2d3d/fonts/jameel-noori-nastaleeq/JameelNooriNastaleeq.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Alvi Nastaleeq';
  src: url('https://cdn.rawgit.com/linuxscout/urdufonts/master/fonts/alvi-nastaleeq/AlviNastaleeq.ttf') format('truetype');
  font-display: swap;
}

/* ===== FORM VALIDATION STYLES ===== */

input:invalid, textarea:invalid {
  border-color: #ff5722;
}

input:valid, textarea:valid {
  border-color: #4CAF50;
}

input:required, textarea:required {
  background-color: #fff;
}

/* ===== LOADING ANIMATION ===== */

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.loading {
  animation: pulse 1.5s infinite;
}

/* ===== SCROLLBAR STYLING ===== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #e91e63, #ff4081);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #d81b60, #f50057);
}



    .validation-error {
        color: #e91e63;
        font-size: 12px;
        margin-top: 5px;
        text-align: right;
        direction: rtl;
        font-weight: bold;
        animation: fadeIn 0.3s ease;
    }
    
    input:invalid:not(:focus):not(:placeholder-shown) {
        border-color: #e91e63;
        background-color: #fff5f5;
    }
    
    input:valid:not(:focus):not(:placeholder-shown) {
        border-color: #4CAF50;
        background-color: #f8fff8;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-5px); }
        to { opacity: 1; transform: translateY(0); }
    }



