/**
 * Custom Styles for Myanmar Income & Expense Manager
 * Complementary styles to Tailwind CSS
 */

/* ========================================
   Myanmar Font Support
   ======================================== */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Myanmar:wght@300;400;500;600;700&display=swap");

body {
  font-family: "Noto Sans Myanmar", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
}

/* ========================================
   Desktop Font Size Adjustments
   ======================================== */
@media (min-width: 768px) {
    /* Reduce heading sizes on desktop */
    h1, .text-3xl { font-size: 1.5rem !important; }
    h2, .text-2xl { font-size: 1.25rem !important; }
    h3, .text-xl { font-size: 1.125rem !important; }
    
    /* Reduce base text size */
    body, .text-base { font-size: 0.875rem !important; }
    .text-sm { font-size: 0.8125rem !important; }
    .text-lg { font-size: 1rem !important; }
    
    /* Reduce button text */
    button, .btn, a.bg-green-600, a.bg-blue-600, a.bg-purple-600, a.bg-orange-600 {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    /* Reduce table text */
    table { font-size: 0.875rem !important; }
    th { font-size: 0.8125rem !important; }
}

/* ========================================
   Select2 Custom Styling
   ======================================== */
.select2-container--default .select2-selection--single {
    height: 48px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem 1rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 48px !important;
    padding-left: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px !important;
}

.select2-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #10b981 !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    padding: 0.5rem !important;
}

/* Customer Select2 Max Width */
select.customer-select + .select2-container {
    max-width: 82% !important;
}

/* ========================================
   Sticky Bottom Navigation
   ======================================== */
.sticky-nav-item {
    transition: all 0.2s ease-in-out;
}

.sticky-nav-item:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    /* Hide bottom nav on desktop if needed */
    /* nav.fixed.bottom-0 {
        display: none;
    } */
}

/* ========================================
   Smooth Transitions
   ======================================== */
* {
  transition-property: background-color, border-color, color, fill, stroke,
    opacity, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* ========================================
   Custom Scrollbar
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========================================
   Focus Styles
   ======================================== */
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
}

/* ========================================
   Table Responsive
   ======================================== */
@media (max-width: 768px) {
  table {
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 0.5rem !important;
  }
}

/* ========================================
   Print Styles for Export
   ======================================== */
@media print {
  body {
    background: white !important;
  }

  .no-print,
  button,
  a[href*="logout"],
  form {
    display: none !important;
  }

  table {
    border-collapse: collapse;
    width: 100%;
  }

  th,
  td {
    border: 1px solid #ddd;
    padding: 8px;
  }

  th {
    background-color: #f3f4f6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ========================================
   Loading Spinner
   ======================================== */
.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================
   Modal Animations
   ======================================== */
#customer-modal {
  animation: fadeIn 0.2s ease-in-out;
}

#customer-modal > div {
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================
   Custom Radio/Checkbox Styles
   ======================================== */
input[type="radio"]:checked,
input[type="checkbox"]:checked {
  background-color: currentColor;
  border-color: currentColor;
}

/* ========================================
   Hover Effects
   ======================================== */
.hover-lift {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Gradient Text
   ======================================== */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   Card Hover Effects
   ======================================== */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Number Input Arrows (Hide)
   ======================================== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ========================================
   Mobile Optimizations
   ======================================== */
@media (max-width: 640px) {
  .min-h-screen {
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }

  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
  }
}

/* ========================================
   Accessibility
   ======================================== */
.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;
}

/* ========================================
   Error States
   ======================================== */
.error-message {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ========================================
   Success States
   ======================================== */
.success-fade {
  animation: successFade 0.5s ease-in-out;
}

@keyframes successFade {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
