/* =================================================================
   UNIVERSAL RESPONSIVE DESIGN SYSTEM
   Mobile-First, Cross-Browser Compatible
   For User Management System
   ================================================================= */

/* =================================================================
   RESET & BASE STYLES
   ================================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* =================================================================
   CROSS-BROWSER COMPATIBILITY
   ================================================================= */

/* Flexbox fallbacks */
.flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.flex-column {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}

.flex-center {
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.flex-between {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

/* CSS Grid fallbacks */
.grid {
  display: -ms-grid;
  display: grid;
}

/* Transform prefixes */
.transform {
  -webkit-transform: translateZ(0);
  -ms-transform: translateZ(0);
  transform: translateZ(0);
}

/* Transition prefixes */
.transition {
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

/* =================================================================
   RESPONSIVE IMAGES & MEDIA
   ================================================================= */

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
  vertical-align: middle;
}

/* Prevent image dragging on mobile */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* =================================================================
   CONTAINER SYSTEM
   ================================================================= */

.container {
  width: 100%;
  max-width: 100%;
  padding-left: 15px;
  padding-right: 15px;
  margin-left: auto;
  margin-right: auto;
}

.container-fluid {
  width: 100%;
  padding-left: 15px;
  padding-right: 15px;
}

/* =================================================================
   RESPONSIVE NAVIGATION
   ================================================================= */

.navbar {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.navbar-brand {
  font-size: 1.25rem;
  text-decoration: none;
  white-space: nowrap;
}

.navbar-nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  padding: 0.5rem 0;
}

/* Hamburger Menu */
.navbar-toggler {
  display: none;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.5)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
}

@media (max-width: 767px) {
  .navbar-toggler {
    display: block;
  }
  
  .navbar-nav {
    display: none;
    width: 100%;
  }
  
  .navbar-nav.show {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
  }
}

/* =================================================================
   BUTTONS - MOBILE FRIENDLY
   ================================================================= */

button, .btn, input[type="submit"], input[type="button"], input[type="reset"], a.button {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  border: 1px solid transparent;
  padding: 12px 24px;
  font-size: 16px;
  line-height: 1.5;
  border-radius: 8px;
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus, .btn:focus, input[type="submit"]:focus, input[type="button"]:focus {
  outline: 2px solid #4A90E2;
  outline-offset: 2px;
}

button:active, .btn:active {
  -webkit-transform: scale(0.98);
  -ms-transform: scale(0.98);
  transform: scale(0.98);
}

button:disabled, .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button sizes */
.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 36px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  min-height: 52px;
}

.btn-block {
  display: block;
  width: 100%;
}

/* =================================================================
   FORM ELEMENTS - MOBILE OPTIMIZED
   ================================================================= */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 8px;
  -webkit-transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  -o-transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  min-height: 44px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* Remove number input spinners on mobile */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Select dropdown arrow */
select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 12px;
  padding-right: 40px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-right: -5px;
  margin-left: -5px;
}

.form-row > * {
  padding-right: 5px;
  padding-left: 5px;
}

/* =================================================================
   CARDS & PANELS
   ================================================================= */

.card, .panel, .box {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: #fff;
  background-clip: border-box;
  border: 1px solid rgba(0,0,0,.125);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-header, .panel-header {
  padding: 15px 20px;
  margin: -20px -20px 20px -20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid rgba(0,0,0,.125);
  border-radius: 12px 12px 0 0;
}

.card-body {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 20px;
}

.card-footer {
  padding: 15px 20px;
  background-color: #f8f9fa;
  border-top: 1px solid rgba(0,0,0,.125);
}

/* =================================================================
   TABLES - RESPONSIVE
   ================================================================= */

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

table th,
table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
  vertical-align: middle;
}

table th {
  font-weight: 600;
  background-color: #f8f9fa;
}

table tr:hover {
  background-color: #f8f9fa;
}

/* Mobile table - stack on small screens */
@media (max-width: 767px) {
  .table-mobile-stack {
    border: 0;
  }
  
  .table-mobile-stack thead {
    display: none;
  }
  
  .table-mobile-stack tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
  }
  
  .table-mobile-stack td {
    display: block;
    text-align: right;
    border: none;
    padding: 8px;
  }
  
  .table-mobile-stack td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
  }
}

/* =================================================================
   MODALS - MOBILE FRIENDLY
   ================================================================= */

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  -webkit-overflow-scrolling: touch;
}

.modal.show {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  width: 95%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  background-color: #fff;
  border-radius: 12px;
  -webkit-box-shadow: 0 5px 25px rgba(0,0,0,0.3);
  box-shadow: 0 5px 25px rgba(0,0,0,0.3);
  margin: 20px auto;
  padding: 0;
  -webkit-animation: modalSlideIn 0.3s ease;
  animation: modalSlideIn 0.3s ease;
}

@-webkit-keyframes modalSlideIn {
  from {
    -webkit-transform: translateY(-50px);
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    -webkit-transform: translateY(0);
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    -webkit-transform: translateY(-50px);
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    -webkit-transform: translateY(0);
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #dee2e6;
}

.modal-body {
  position: relative;
  -webkit-box-flex: 1;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 20px;
}

.modal-footer {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: end;
  -ms-flex-pack: end;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid #dee2e6;
}

.close {
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  color: #000;
  opacity: 0.5;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  min-height: 44px;
  min-width: 44px;
}

.close:hover {
  opacity: 0.75;
}

/* =================================================================
   GRID SYSTEM - MOBILE FIRST
   ================================================================= */

.row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  -webkit-box-flex: 1;
  -ms-flex: 1 0 0%;
  flex: 1 0 0%;
}

/* Simple grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: -webkit-box; display: -ms-flexbox; display: flex; }

/* Width */
.w-100 { width: 100%; }
.w-75 { width: 75%; }
.w-50 { width: 50%; }
.w-25 { width: 25%; }

/* =================================================================
   TABLET BREAKPOINT (768px and up)
   ================================================================= */

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .navbar-nav {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
  }
  
  .nav-item {
    padding: 0 1rem;
  }
  
  .btn {
    padding: 14px 28px;
    font-size: 16px;
  }
  
  .card, .panel, .box {
    padding: 24px;
  }
  
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  /* Responsive utilities */
  .d-md-none { display: none; }
  .d-md-block { display: block; }
  .d-md-flex { display: -webkit-box; display: -ms-flexbox; display: flex; }
}

/* =================================================================
   DESKTOP BREAKPOINT (1024px and up)
   ================================================================= */

@media (min-width: 1024px) {
  .container {
    max-width: 960px;
    padding-left: 24px;
    padding-right: 24px;
  }
  
  .btn {
    padding: 16px 32px;
  }
  
  button:hover, .btn:hover {
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    transform: translateY(-2px);
    -webkit-box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .card:hover, .panel:hover {
    -webkit-box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
  
  .card, .panel, .box {
    padding: 32px;
  }
  
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Responsive utilities */
  .d-lg-none { display: none; }
  .d-lg-block { display: block; }
  .d-lg-flex { display: -webkit-box; display: -ms-flexbox; display: flex; }
}

/* =================================================================
   LARGE DESKTOP BREAKPOINT (1440px and up)
   ================================================================= */

@media (min-width: 1440px) {
  .container {
    max-width: 1200px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(5, 1fr);
  }
  
  /* Responsive utilities */
  .d-xl-none { display: none; }
  .d-xl-block { display: block; }
  .d-xl-flex { display: -webkit-box; display: -ms-flexbox; display: flex; }
}

/* =================================================================
   ACCESSIBILITY
   ================================================================= */

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible */
*:focus-visible {
  outline: 2px solid #4A90E2;
  outline-offset: 2px;
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
  
  .no-print,
  button,
  .btn {
    display: none !important;
  }
}

/* =================================================================
   MOBILE SPECIFIC FIXES
   ================================================================= */

/* Prevent zoom on input focus in iOS */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="week"],
  input[type="number"],
  input[type="email"],
  input[type="url"],
  input[type="search"],
  input[type="tel"],
  input[type="color"] {
    font-size: 16px;
  }
}

/* Remove tap highlight on mobile */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Smooth scrolling on iOS */
body {
  -webkit-overflow-scrolling: touch;
}

/* =================================================================
   LOADING STATES
   ================================================================= */

.loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: wait;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4A90E2;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  -webkit-animation: spin 1s linear infinite;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}


