/* PlayStation Astro Branding */
:root {
  --ps-blue: #003087;
  --ps-light-blue: #0070cc;
  --ps-dark-blue: #001a4d;
  --ps-white: #ffffff;
  --ps-black: #000000;
  --ps-gray: #f0f0f0;
  --ps-dark-gray: #666666;
  --astro-accent: #00d9ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--ps-dark-blue);
  color: var(--ps-white);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    url('/images/astro-bot-rescue-mission-960x720.jpg'),
    url('/images/131918-games-news-buyer-s-guide-the-best-game-characters-that-defined-25-years-of-playstation-image1-6tdtn8u0wf.avif'),
    url('/images/astro-bot-rescue-mission-960x720.jpg'),
    url('/images/131918-games-news-buyer-s-guide-the-best-game-characters-that-defined-25-years-of-playstation-image1-6tdtn8u0wf.avif');
  background-size: 30% auto, 40% auto, 25% auto, 35% auto;
  background-position:
    5% 10%,
    65% 5%,
    75% 70%,
    10% 65%;
  background-repeat: no-repeat;
  opacity: 0.12;
  z-index: 0;
  filter: blur(3px);
  animation: subtle-float 20s ease-in-out infinite;
}

@keyframes subtle-float {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.02);
  }
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 48, 135, 0.85) 0%, rgba(0, 26, 77, 0.9) 100%);
  z-index: 0;
  pointer-events: none;
}

body > * {
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--astro-accent);
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #00d9ff 0%, #0070cc 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 15px rgba(0, 217, 255, 0.4);
  animation: float 3s ease-in-out infinite;
  background-image: url('/images/astro-bot-rescue-mission-960x720.jpg');
  background-size: cover;
  background-position: center;
  border: 3px solid rgba(0, 217, 255, 0.6);
  overflow: hidden;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.logo h1 {
  font-size: 2rem;
  font-weight: bold;
  color: var(--astro-accent);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.logo span {
  font-size: 0.875rem;
  color: var(--ps-white);
  opacity: 0.8;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-size: 0.875rem;
}

.logout-btn {
  background: var(--ps-light-blue);
  color: var(--ps-white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.3s;
}

.logout-btn:hover {
  background: var(--astro-accent);
}

/* Navigation */
.nav-tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-tab {
  padding: 1rem 2rem;
  color: var(--ps-white);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  font-weight: 500;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  border-bottom-color: var(--astro-accent);
}

.nav-tab.active {
  border-bottom-color: var(--astro-accent);
  background: rgba(0, 217, 255, 0.1);
}

/* Main Content */
.main-content {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  color: var(--ps-black);
}

.card h2 {
  color: var(--ps-blue);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--astro-accent);
  padding-bottom: 0.5rem;
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 3rem;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  color: var(--ps-black);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #00d9ff 0%, #0070cc 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  box-shadow: 0 8px 25px rgba(0, 217, 255, 0.6);
  margin: 0 auto 1.5rem;
  animation: float 3s ease-in-out infinite;
  background-image: url('/images/astro-bot-rescue-mission-960x720.jpg');
  background-size: 140%;
  background-position: center 35%;
  border: 4px solid rgba(255, 255, 255, 0.8);
  overflow: hidden;
  position: relative;
}

.login-logo-icon::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 70%
  );
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.login-logo h1 {
  font-size: 3rem;
  color: var(--ps-blue);
  margin-bottom: 0.5rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.login-logo .subtitle {
  color: var(--ps-dark-gray);
  font-size: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--ps-dark-blue);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--astro-accent);
}

.btn {
  background: var(--ps-blue);
  color: var(--ps-white);
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  background: var(--ps-light-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 112, 204, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
}

.btn-secondary {
  background: var(--ps-dark-gray);
}

.btn-secondary:hover {
  background: var(--ps-gray);
  color: var(--ps-black);
}

.btn-success {
  background: #28a745;
}

.btn-success:hover {
  background: #218838;
}

.btn-danger {
  background: #dc3545;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.sso-divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.sso-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ddd;
}

.sso-divider span {
  background: white;
  padding: 0 1rem;
  position: relative;
  color: var(--ps-dark-gray);
}

.sso-button {
  width: 100%;
  padding: 0.75rem;
  background: var(--ps-white);
  border: 2px solid var(--ps-blue);
  color: var(--ps-blue);
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
  text-transform: uppercase;
}

.sso-button:hover {
  background: var(--ps-blue);
  color: var(--ps-white);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

thead {
  background: var(--ps-blue);
  color: var(--ps-white);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

tr:hover {
  background: rgba(0, 217, 255, 0.1);
}

/* Chat Interface */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
  border: 2px solid var(--ps-blue);
  border-radius: 10px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: white;
}

.chat-message {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 10px;
  max-width: 80%;
}

.chat-message.user {
  background: var(--ps-blue);
  color: white;
  margin-left: auto;
  text-align: right;
}

.chat-message.assistant {
  background: var(--ps-gray);
  color: var(--ps-black);
}

.chat-input-area {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--ps-gray);
  border-top: 2px solid var(--ps-blue);
}

.chat-input-area input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--ps-blue);
  border-radius: 5px;
  font-size: 1rem;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Connection Status */
.connection-item {
  padding: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.connection-item h3 {
  color: var(--ps-blue);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-badge.connected {
  background: #28a745;
  color: white;
}

.status-badge.disconnected {
  background: #dc3545;
  color: white;
}

.status-badge.draft {
  background: #ffc107;
  color: var(--ps-black);
}

.status-badge.active {
  background: #28a745;
  color: white;
}

/* Brief/Plan/Campaign Cards */
.item-card {
  background: white;
  border: 2px solid var(--ps-blue);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s;
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--astro-accent);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
  transform: translateY(-2px);
}

.item-card h3 {
  color: var(--ps-blue);
  margin-bottom: 0.75rem;
}

.item-meta {
  font-size: 0.875rem;
  color: var(--ps-dark-gray);
  margin-top: 0.5rem;
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--astro-accent);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Info Banner */
.info-banner {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
  animation: slideDown 0.5s ease-out;
}

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

.info-banner-content {
  flex: 1;
  padding-right: 2rem;
}

.info-banner-content strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.info-banner-content p {
  margin: 0;
  line-height: 1.6;
  font-size: 0.95rem;
}

.info-banner-close {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.info-banner-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Alert Messages */
.alert {
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Deep Links */
.deep-link {
  color: var(--ps-light-blue);
  text-decoration: none;
  font-weight: bold;
}

.deep-link:hover {
  color: var(--astro-accent);
  text-decoration: underline;
}

/* JSON Viewer */
.json-viewer {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  margin: auto;
  padding: 2rem;
  border: 2px solid var(--ps-blue);
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 48, 135, 0.4);
}

.modal-content h3 {
  color: var(--ps-blue);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--astro-accent);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    flex-wrap: wrap;
  }

  .nav-tab {
    padding: 0.75rem 1rem;
  }

  .header {
    flex-direction: column;
    gap: 1rem;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }
}
