html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
}

/* ================================
   FOOTER OVERLAP PREVENTION SYSTEM
   ================================ */

/* Universal page wrapper for all content pages */
.page-content-wrapper {
  min-height: calc(100vh - 280px); /* Account for header (80px) + footer (200px) */
  padding-bottom: 8rem; /* Large bottom padding to prevent footer overlap */
  margin-bottom: 3rem; /* Additional margin for safety */
}

/* Specific page wrappers */
.collections-wrapper,
.learning-wrapper,
.words-wrapper,
.admin-wrapper,
.auth-wrapper {
  min-height: calc(100vh - 280px);
  padding-bottom: 7rem;
  margin-bottom: 2.5rem;
}

/* Content sections that need extra spacing */
.main-content-section {
  margin-bottom: 4rem;
}

.main-content-section:last-child {
  margin-bottom: 6rem;
}

/* Cards and panels */
.card:last-of-type,
.panel:last-of-type {
  margin-bottom: 3rem;
}

/* Tables and lists */
.table-responsive:last-child {
  margin-bottom: 4rem;
}

/* Forms */
.form-container:last-child {
  margin-bottom: 5rem;
}

/* Button groups and action sections */
.action-buttons,
.button-group {
  margin-bottom: 3rem;
}

/* Responsive footer prevention */
@media (max-width: 1200px) {
  .page-content-wrapper,
  .collections-wrapper,
  .learning-wrapper,
  .words-wrapper,
  .admin-wrapper,
  .auth-wrapper {
    min-height: calc(100vh - 260px);
    padding-bottom: 6rem;
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .page-content-wrapper,
  .collections-wrapper,
  .learning-wrapper,
  .words-wrapper,
  .admin-wrapper,
  .auth-wrapper {
    min-height: calc(100vh - 240px);
    padding-bottom: 5rem;
    margin-bottom: 1.5rem;
  }

  .main-content-section:last-child {
    margin-bottom: 4rem;
  }

  .card:last-of-type,
  .panel:last-of-type {
    margin-bottom: 2rem;
  }
}

@media (max-width: 576px) {
  .page-content-wrapper,
  .collections-wrapper,
  .learning-wrapper,
  .words-wrapper,
  .admin-wrapper,
  .auth-wrapper {
    min-height: calc(100vh - 220px);
    padding-bottom: 4rem;
    margin-bottom: 1rem;
  }

  .main-content-section:last-child {
    margin-bottom: 3rem;
  }
}

/* ================================
   ORIGINAL STYLES (PRESERVED)
   ================================ */

/* Enhanced Vietnamese text support with proper Unicode fonts */
.vietnamese-text,
.vietnamese-input {
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Noto Sans Vietnamese', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1, "clig" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.vietnamese-input {
  letter-spacing: 0.01em;
  word-spacing: 0.02em;
}

.vietnamese-input::placeholder {
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Noto Sans Vietnamese', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
  opacity: 0.6;
}

/* Ensure Vietnamese characters display correctly in all contexts */
input[type="text"],
textarea,
.form-control {
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Noto Sans Vietnamese', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
  -webkit-font-feature-settings: "kern" 1, "liga" 1, "clig" 1;
  -moz-font-feature-settings: "kern" 1, "liga" 1, "clig" 1;
  font-feature-settings: "kern" 1, "liga" 1, "clig" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Better Vietnamese character spacing and rendering */
.card-text.vietnamese-text {
  letter-spacing: 0.01em;
  word-spacing: 0.02em;
  font-weight: 400;
}

/* Fix for special Vietnamese characters in modal */
.modal .vietnamese-text,
.modal .vietnamese-input {
  unicode-bidi: embed;
  direction: ltr;
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Noto Sans Vietnamese', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
}

/* Pronunciation text styling */
.pronunciation-text {
  font-family: 'Times New Roman', 'Liberation Serif', 'DejaVu Serif', serif;
  font-style: italic;
  color: #6c757d;
  font-feature-settings: "kern" 1, "liga" 1;
}

.pronunciation-modal {
  font-weight: 300;
  opacity: 0.9;
  font-size: 0.9em;
}

.pronunciation-input {
  font-family: 'Times New Roman', 'Liberation Serif', 'DejaVu Serif', serif;
}

/* Word card enhancements */
.word-card {
  transition: all 0.3s ease;
  border: 1px solid #dee2e6;
}

.word-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  border-color: #007bff;
}

/* List view improvements */
.table-hover tbody tr:hover {
  background-color: rgba(0, 123, 255, 0.05);
}

.table th {
  border-top: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

.table td {
  vertical-align: middle;
  padding: 1rem 0.75rem;
  border-top: 1px solid #dee2e6;
}

/* View toggle buttons */
.btn-group .btn-check:checked + .btn-outline-primary {
  background-color: #007bff;
  border-color: #007bff;
  color: white;
}

/* Badge improvements */
.badge {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25px;
}

/* Modal enhancements */
.modal-content {
  border: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header.bg-primary {
  border-bottom: none;
}

/* Form improvements */
.form-control:focus,
.form-select:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Alert improvements */
.alert {
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
}

/* Loading animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.word-card {
  animation: fadeIn 0.5s ease-out;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .word-card {
    margin-bottom: 1rem;
  }
  
  .table-responsive {
    border: none;
  }
  
  .modal-dialog {
    margin: 0.5rem;
  }
}

/* Dark mode support preparation */
@media (prefers-color-scheme: dark) {
  .card {
    background-color: #2d3748;
    border-color: #4a5568;
  }
  
  .table {
    color: #e2e8f0;
  }
  
  .table th {
    background-color: #4a5568;
    color: #e2e8f0;
  }
}

/* ================================
   GAME-SPECIFIC STYLES
   ================================ */

/* Purple color for Word Builder game */
.text-purple {
  color: #6f42c1 !important;
}

/* ================================
   UNIVERSAL DASHBOARD CARD STYLES
   Applied to all pages for consistency
   ================================ */

/* Global Card Styling - Applied to all pages */
.card {
    background: white !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border: none !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border-bottom: 1px solid #e9ecef !important;
    padding: 1.5rem !important;
    border-radius: 20px 20px 0 0 !important;
}

.card-body {
    background-color: #ffffff !important;
    padding: 2rem !important;
}

.card-footer {
    background-color: #ffffff !important;
    border-top: 1px solid #dee2e6 !important;
    padding: 1.5rem !important;
    border-radius: 0 0 20px 20px !important;
}

/* Enhanced Card Interactions */
.card.clickable,
.word-card,
.collection-card,
.game-mode-card {
    cursor: pointer !important;
    position: relative !important;
}

.card.clickable:hover,
.word-card:hover,
.collection-card:hover,
.game-mode-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15) !important;
    border-color: #007bff !important;
}

/* Card Groups and Grids */
.card-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card-list .card {
    margin-bottom: 1.5rem;
}

/* Special Card Types */
.dashboard-card {
    background: white !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border: none !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

.dashboard-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

.dashboard-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border-bottom: 1px solid #e9ecef !important;
    padding: 1.5rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ================================
   IMPROVED WELCOME BANNER COLORS
   ================================ */

/* Welcome Header with Better Colors */
.welcome-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%) !important;
    border-radius: 0 0 30px 30px !important;
    position: relative !important;
    overflow: hidden !important;
}

.welcome-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 20px 20px;
    opacity: 0.3;
}

.welcome-content {
    position: relative;
    z-index: 2;
}

/* Hero Section for Non-authenticated Users */
.hero-section {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%) !important;
    border-radius: 20px !important;
}

/* Text Colors for Better Contrast */
.text-white-75 {
    color: rgba(255, 255, 255, 0.75) !important;
}

.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.text-warning-50 {
    color: rgba(255, 193, 7, 0.8) !important;
}

/* Welcome Stats Styling */
.welcome-stats .stat-item {
    background: rgba(255, 255, 255, 0.2) !important;
    padding: 1.5rem !important;
    border-radius: 15px !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.welcome-stats .stat-number {
    font-size: 2.5rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.25rem !important;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.welcome-stats .stat-label {
    font-size: 0.9rem !important;
    opacity: 0.9 !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* ================================
   ENHANCED BUTTON STYLES
   ================================ */

/* Consistent Button Styling Across All Pages */
.btn {
    border-radius: 12px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    border: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
    color: #ffffff !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%) !important;
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.4) !important;
}

.btn-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%) !important;
    color: #ffffff !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #157347 0%, #146c43 100%) !important;
    box-shadow: 0 8px 25px rgba(25, 135, 84, 0.4) !important;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffcd39 100%) !important;
    color: #000 !important;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffcd39 0%, #ffd60a 100%) !important;
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.4) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%) !important;
    color: #ffffff !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #bb2d3b 0%, #b02a37 100%) !important;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4) !important;
}

.btn-outline-primary {
    background-color: transparent !important;
    color: #0d6efd !important;
    border: 2px solid #0d6efd !important;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
    color: #ffffff !important;
    border-color: #0d6efd !important;
}

.btn-outline-light {
    background-color: transparent !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    backdrop-filter: blur(10px) !important;
}

/* ================================
   CONSISTENT ALERT STYLES
   ================================ */

/* Enhanced Alert Styling */
.alert {
    border: none !important;
    border-radius: 15px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    padding: 1.25rem 1.5rem !important;
    margin-bottom: 1.5rem !important;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    color: #155724 !important;
    border-left: 4px solid #28a745 !important;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    color: #721c24 !important;
    border-left: 4px solid #dc3545 !important;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%) !important;
    color: #856404 !important;
    border-left: 4px solid #ffc107 !important;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%) !important;
    color: #0c5460 !important;
    border-left: 4px solid #17a2b8 !important;
}

/* ================================
   ENHANCED MODAL STYLES
   ================================ */

/* Consistent Modal Styling */
.modal-content {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: none !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3) !important;
    overflow: hidden !important;
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border-bottom: 1px solid #e9ecef !important;
    padding: 1.5rem 2rem !important;
    border-radius: 20px 20px 0 0 !important;
}

.modal-body {
    background-color: #ffffff !important;
    padding: 2rem !important;
}

.modal-footer {
    background-color: #ffffff !important;
    border-top: 1px solid #dee2e6 !important;
    padding: 1.5rem 2rem !important;
    border-radius: 0 0 20px 20px !important;
}

.modal-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
    color: #ffffff !important;
    border-bottom: none !important;
}

/* ================================
   ENHANCED TABLE STYLES
   ================================ */

/* Consistent Table Styling */
.table {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-radius: 15px !important;
    overflow: hidden !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
}

.table td, 
.table th {
    background-color: #ffffff !important;
    color: #212529 !important;
    padding: 1rem 0.75rem !important;
    border-top: 1px solid #dee2e6 !important;
    vertical-align: middle !important;
}

.table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border-top: none !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    font-size: 0.875rem !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(13, 110, 253, 0.08) !important;
}

.table-light > :not(caption) > * > * {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    color: #212529 !important;
}

.table-responsive {
    border: none !important;
    border-radius: 15px !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
    margin-bottom: 2rem !important;
}

/* ================================
   ENHANCED FORM CONTROLS
   ================================ */

/* Consistent Form Styling */
.form-control, 
.form-select, 
input[type="text"], 
input[type="email"], 
input[type="password"], 
textarea, 
select {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 2px solid #e9ecef !important;
    border-radius: 12px !important;
    padding: 0.75rem 1rem !important;
    transition: all 0.3s ease !important;
    font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Noto Sans Vietnamese', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.form-control:focus, 
.form-select:focus, 
input:focus, 
textarea:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    transform: translateY(-1px) !important;
}

/* ================================
   ENHANCED BADGE STYLES
   ================================ */

/* Consistent Badge Styling */
.badge {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.25px !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.badge:hover {
    transform: scale(1.05) !important;
}

.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
}

.bg-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffcd39 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #31d2f2 100%) !important;
}

.bg-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

.bg-dark {
    background: linear-gradient(135deg, #212529 0%, #495057 100%) !important;
}

/* ================================
   PAGE WRAPPER CONSISTENCY
   ================================ */

/* Consistent Page Background */
body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    margin-bottom: 60px;
    font-family: 'Segoe UI', 'Roboto', 'Noto Sans', 'Arial Unicode MS', 'Lucida Sans Unicode', 'DejaVu Sans', 'Liberation Sans', Arial, sans-serif;
}

/* Page Wrappers */
.page-content-wrapper,
.collections-wrapper,
.learning-wrapper,
.words-wrapper,
.admin-wrapper,
.auth-wrapper,
.dashboard-wrapper {
    min-height: calc(100vh - 280px);
    padding-bottom: 8rem;
    margin-bottom: 3rem;
    background: transparent !important;
}

/* ================================
   RESPONSIVE ENHANCEMENTS
   ================================ */

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .card {
        border-radius: 15px !important;
        margin-bottom: 1.5rem !important;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 1.25rem !important;
    }
    
    .modal-dialog {
        margin: 0.5rem !important;
    }
    
    .modal-content {
        border-radius: 15px !important;
    }
    
    .btn {
        padding: 0.625rem 1.25rem !important;
        border-radius: 10px !important;
    }
    
    .welcome-header {
        text-align: center !important;
        padding: 2rem 0 !important;
    }
    
    .table-responsive {
        border-radius: 10px !important;
    }
}

@media (max-width: 576px) {
    .card {
        border-radius: 12px !important;
    }
    
    .modal-content {
        border-radius: 12px !important;
    }
    
    .btn {
        border-radius: 8px !important;
    }
    
    .welcome-header {
        border-radius: 0 0 20px 20px !important;
    }
}