/*
Theme Name: Maintenance Report Theme
Theme URI: https://itservice.rru.ac.th/web
Description: Custom theme for displaying maintenance reports from Looker Studio and IT Service system
Version: 1.1.0
Author: IT Service Team
Author URI: https://itservice.rru.ac.th
Text Domain: maintenance-theme
*/

/* ==========================================================================
   CSS Variables - Design System
   ========================================================================== */
:root {
  /* Colors - IT Service Theme */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --secondary: #3b82f6;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f97316;

  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-dark: #111827;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-light: #ffffff;

  /* Typography */
  --font-sans: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Inter', 'Sarabun', sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;

  /* Borders */
  --radius: 0.5rem;
  --radius-sm: 0.25rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1.125rem;
}

p {
  margin-bottom: var(--space-sm);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-lg);
}

.main-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.current {
  background-color: var(--bg-tertiary);
  color: var(--primary);
  text-decoration: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  margin: 5px 0;
  transition: var(--transition);
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   Cards & Components
   ========================================================================== */
.card {
  background: linear-gradient(145deg, #ffffff, #fafbfc);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #34d399);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.10),
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.06);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--bg-tertiary);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

/* ==========================================================================
   Hero Section (Enhanced)
   ========================================================================== */
.hero-section {
  padding: 3rem 0;
  text-align: center;
  background: linear-gradient(-45deg, #10b981, #059669, #047857, #34d399);
  background-size: 400% 400%;
  color: white;
  border-radius: var(--radius-lg);
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}

/* Remove infinite animation - it was causing scroll issues */

@keyframes heroGradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes heroShine {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Stat Cards (Enhanced with animations)
   ========================================================================== */
.stat-card {
  animation: fadeInUp 0.6s ease-out both;
  position: relative;
  overflow: hidden;
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.3;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Search & Filter Controls
   ========================================================================== */
.repair-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  background: linear-gradient(145deg, #f0fdf4, #ecfdf5);
  border-radius: var(--radius-lg);
  border: 1px solid #d1fae5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.repair-controls .search-wrapper {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.repair-controls .search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  pointer-events: none;
  opacity: 0.7;
  z-index: 1;
}

.repair-controls input[type="search"] {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 2px solid #d1fae5;
  border-radius: var(--radius);
  font-family: var(--font-thai);
  font-size: 0.9375rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
}

.repair-controls input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  transform: translateY(-1px);
}

.repair-controls input[type="search"]::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.repair-controls select {
  padding: 0.875rem 2.75rem 0.875rem 1.125rem;
  border: 2px solid #d1fae5;
  border-radius: var(--radius);
  font-family: var(--font-thai);
  font-size: 0.9375rem;
  font-weight: 500;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%2310b981' d='M7 10L2 5h10z'/%3E%3C/svg%3E") no-repeat right 1rem center;
  background-size: 14px;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 200px;
}

.repair-controls select:hover {
  border-color: #a7f3d0;
  transform: translateY(-1px);
}

.repair-controls select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  transform: translateY(-1px);
}

.repair-result-count {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: var(--radius);
  white-space: nowrap;
  border: 1px solid #e5e7eb;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.repair-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.pag-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.pag-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.pag-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pag-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pag-dots {
  padding: 0.5rem 0.25rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Completion Rate Bar
   ========================================================================== */
.completion-bar-wrapper {
  margin-bottom: var(--space-lg);
}

.completion-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.completion-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.completion-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: var(--radius-full);
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.completion-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-light);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {

  .container,
  .container-wide {
    padding: 0 var(--space-sm);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  /* Mobile menu */
  .mobile-menu-toggle {
    display: block;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-xl);
    padding: 5rem var(--space-lg) var(--space-lg);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
  }

  .main-nav.nav-open {
    right: 0;
  }

  .main-nav ul {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .main-nav a {
    display: block;
    padding: 0.75rem var(--space-sm);
  }

  /* Table horizontal scroll */
  .repairs-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .repairs-table table {
    min-width: 700px;
  }

  /* Search controls stack */
  .repair-controls {
    flex-direction: column;
  }

  .repair-controls .search-wrapper,
  .repair-controls select {
    width: 100%;
    min-width: unset;
  }

  /* Hero section */
  .hero-section {
    margin: 1rem 0;
    padding: 2rem var(--space-sm);
    border-radius: var(--radius);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }
}