/* ==========================================================================
   TempestXI - Retro FFXI Inspired Theme
   Clean, functional, nostalgic
   ========================================================================== */

/* CSS Variables */
:root {
  /* Core colors - Warm cream/gold palette */
  --bg-dark: #f5e6c8;
  --bg-main: #fdf8f0;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);

  /* Borders and accents */
  --border: #d4c4a8;
  --border-light: #c9a227;
  --border-glow: #d4b82e;

  /* Text colors */
  --text: #6b5b4a;
  --text-bright: #5a4a3a;
  --text-muted: #8b7b6a;
  --text-dim: #a89b8a;

  /* Accent colors */
  --accent: #8b6914;
  --accent-bright: #a67c00;
  --accent-glow: #c9a227;

  /* Status colors */
  --success: #3d9970;
  --error: #c0392b;
  --warning: #d4a84b;

  /* Online status colors */
  --online: #22c55e;
  --offline: #ef4444;

  /* Layout */
  --radius: 4px;
  --radius-lg: 6px;
  --nav-h: 52px;
  --sidebar-w: 220px;
  --max-width: 1100px;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: linear-gradient(180deg, #fdf8f0 0%, #f5e6c8 50%, #e8d4a8 100%);
  background-attachment: fixed;
  padding-top: var(--nav-h);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

body.no-nav {
  padding-top: 0;
}

body.has-sidebar {
  padding-top: 60px;
  padding-left: 0;
}

main {
  flex: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-bright);
}

h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-bright);
  text-decoration: underline;
}

/* Container */
.container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* Common Page Elements */
.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: var(--border-light);
  color: var(--text-bright);
  text-decoration: none;
}

.btn-primary, .btn.btn-primary {
  background: linear-gradient(180deg, #c9a227 0%, #a68b1a 100%);
  border-color: #d4b82e;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover, .btn.btn-primary:hover {
  background: linear-gradient(180deg, #d4b82e 0%, #c9a227 100%);
  border-color: #e0c435;
  color: #fff;
}

.btn-secondary, .btn.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover, .btn.btn-secondary:hover {
  border-color: var(--border-light);
  color: var(--text);
  background: var(--bg-card);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 28px;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text);
}

/* Badge Components */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 12px;
}

.badge-success {
  background: rgba(61, 153, 112, 0.15);
  color: var(--success);
  border: 1px solid rgba(61, 153, 112, 0.3);
}

.badge-danger {
  background: rgba(192, 57, 43, 0.15);
  color: var(--error);
  border: 1px solid rgba(192, 57, 43, 0.3);
}

.badge-warning {
  background: rgba(212, 168, 75, 0.15);
  color: var(--warning);
  border: 1px solid rgba(212, 168, 75, 0.3);
}

.badge-secondary {
  background: rgba(108, 117, 125, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(108, 117, 125, 0.3);
}

/* Search Components */
.search-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-glow);
}

.search-input::placeholder {
  color: var(--text-dim);
}

/* Empty State */
.no-data {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Utility Classes */
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
}

.actions {
  text-align: center;
  margin-top: 32px;
}

/* Hero Section Components */
.hero {
  margin-bottom: 20px;
  text-align: center;
}

.hero-image {
  width: 100%;
  max-width: 750px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 3px solid var(--accent-glow);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px var(--bg-dark),
    0 0 20px rgba(201, 162, 39, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.15);
}

.hero-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-cta {
  display: inline-block;
  padding: 10px 24px;
  background: linear-gradient(180deg, var(--accent-glow) 0%, var(--accent) 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.15s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.hero-cta:hover {
  background: linear-gradient(180deg, var(--border-glow) 0%, var(--accent-glow) 100%);
  text-decoration: none;
  color: #fff;
}

.hero-cta-secondary {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  text-shadow: none;
}

.hero-cta-secondary:hover {
  background: rgba(255, 255, 255, 1);
  border-color: var(--border-glow);
}

.hero-cta-disabled {
  background: rgba(200, 200, 200, 0.5);
  border: 1px solid #ccc;
  color: #999;
  text-shadow: none;
  cursor: default;
}

/* Alert Components */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid;
}

.alert-success {
  background: rgba(61, 153, 112, 0.15);
  border-color: var(--success);
  color: #6fcf97;
}

.alert-error {
  background: rgba(192, 57, 43, 0.15);
  border-color: var(--error);
  color: #e57373;
}

.alert-warning {
  background: rgba(212, 168, 75, 0.15);
  border-color: var(--warning);
  color: var(--warning);
}

/* Form Elements */
input, select, textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-bright);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.2);
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 16px;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: var(--nav-h);
  gap: 20px;
}

.nav-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.nav-brand a:hover {
  color: var(--accent-bright);
  text-decoration: none;
}

.nav-logo {
  height: 28px;
  width: 28px;
  object-fit: cover;
  border-radius: 50%;
}

.nav-status {
  display: flex;
  align-items: center;
}

.server-badge-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-dot.offline {
  background: var(--error);
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: var(--bg-card);
}

.nav-link.login {
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, #c9a227 0%, #a68b1a 100%);
  color: #fff;
}

.nav-link.login:hover {
  border-color: #d4b82e;
  background: linear-gradient(180deg, #d4b82e 0%, #c9a227 100%);
  color: #fff;
}

.nav-link.logout {
  color: var(--text-muted);
}

.nav-link.logout:hover {
  color: var(--text);
}

.nav-link.profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-avatar,
.nav-avatar-placeholder {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-light);
}

.nav-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: var(--border);
  color: var(--text);
}

.nav-link.admin {
  background: var(--border);
  color: var(--text-bright);
}

.nav-link.admin:hover {
  background: var(--border-light);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  gap: 4px;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  transition: 0.2s;
}

/* Site Header Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(253, 248, 240, 0.98) 0%, rgba(245, 230, 200, 0.98) 100%);
  border-bottom: 2px solid var(--accent-glow);
  backdrop-filter: blur(8px);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(139, 105, 20, 0.15);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header-brand:hover {
  text-decoration: none;
}

.header-logo {
  height: 40px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.header-link {
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s;
  white-space: nowrap;
}

.header-link:hover {
  color: var(--accent);
  background: rgba(201, 162, 39, 0.1);
  text-decoration: none;
}

.header-link.active {
  color: var(--accent);
  background: rgba(201, 162, 39, 0.15);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-status {
  display: flex;
  align-items: center;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
}

.header-profile:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--border-light);
  text-decoration: none;
}

.header-profile.active {
  border-color: var(--accent-glow);
}

.header-avatar,
.header-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-glow);
  flex-shrink: 0;
}

.header-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(180deg, #c9a227 0%, #a68b1a 100%);
  color: #fff;
}

.header-username {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-admin {
  background: rgba(201, 162, 39, 0.2);
  border: 1px solid var(--accent-glow);
}

.header-admin:hover {
  background: rgba(201, 162, 39, 0.3);
}

.header-logout {
  color: var(--text-muted);
}

.header-logout:hover {
  color: var(--error);
  background: rgba(192, 57, 43, 0.1);
}

.header-login {
  background: linear-gradient(180deg, #c9a227 0%, #a68b1a 100%);
  color: #fff !important;
  border: 1px solid var(--accent-glow);
}

.header-login:hover {
  background: linear-gradient(180deg, #d4b82e 0%, #c9a227 100%);
  color: #fff !important;
}

.header-register {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
}

.header-register:hover {
  border-color: var(--accent-glow);
  background: rgba(255, 255, 255, 1);
}

/* Header mobile toggle */
.header-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 8px;
  gap: 4px;
  margin-left: auto;
}

.header-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: 0.2s;
  display: block;
}

.header-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.header-toggle.active span:nth-child(2) {
  opacity: 0;
}

.header-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Mobile dropdown menu */
.header-mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(253, 248, 240, 0.99) 0%, rgba(245, 230, 200, 0.99) 100%);
  border-bottom: 2px solid var(--accent-glow);
  padding: 12px;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(139, 105, 20, 0.15);
}

.header-mobile-menu.active {
  display: flex;
}

.header-mobile-link {
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.header-mobile-link:hover {
  color: var(--accent);
  background: rgba(201, 162, 39, 0.1);
  text-decoration: none;
}

.header-mobile-link.active {
  color: var(--accent);
  background: rgba(201, 162, 39, 0.15);
}

.header-mobile-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.header-mobile-logout {
  color: var(--text-muted);
}

.header-mobile-logout:hover {
  color: var(--error);
  background: rgba(192, 57, 43, 0.1);
}

/* Header responsive - medium screens */
@media (max-width: 1100px) {
  .header-link {
    padding: 8px 8px;
    font-size: 12px;
  }

  .header-username {
    display: none;
  }

  .header-profile {
    padding: 4px;
  }
}

@media (max-width: 900px) {
  .header-nav,
  .header-profile,
  .header-admin,
  .header-logout {
    display: none;
  }

  .header-right {
    margin-left: auto;
    gap: 8px;
  }

  .header-toggle {
    display: flex;
  }
}

/* Footer */
footer {
  margin-top: auto;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
}

footer a:hover {
  color: var(--accent-bright);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  transition: 0.2s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--border);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: var(--accent);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #c9a227;
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #d4c4a8;
}

th {
  background: linear-gradient(180deg, #c9a227 0%, #a68b1a 100%);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

td {
  color: var(--text-bright);
}

tr:hover td {
  background: rgba(201, 162, 39, 0.1);
}

tr:last-child td {
  border-bottom: none;
}

/* Responsive - Mobile Navigation */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 16px;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px;
    gap: 4px;
    transform: translateY(-150%);
    transition: transform 0.2s;
  }

  .nav-links.active {
    transform: translateY(0);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 10px;
  }

  .header-inner {
    padding: 0 12px;
  }
}

@media (max-width: 600px) {
  :root {
    --nav-h: 48px;
  }

  .container {
    padding: 0 12px;
  }

  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
}

/* Page Logo (for pages without navbar) */
.page-logo {
  text-align: center;
  padding: 30px 0 20px;
}

.page-logo img {
  max-width: 280px;
  height: auto;
}

.page-logo a {
  display: inline-block;
}

/* Utility Classes */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
