@import url("portal-styles.css");
@import url("downloader-styles.css");
@import url("emulators-styles.css");

/* Base Styles */
:root {
  --color-background: #0f172a;
  --color-background-gradient-start: #0f172a;
  --color-background-gradient-middle: #581c87;
  --color-background-gradient-end: #0f172a;
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.8);
  --color-text-subtle: rgba(255, 255, 255, 0.6);
  --color-border: #1e293b;
  --color-card-bg: rgba(30, 41, 59, 0.3);
  --color-card-border: #334155;
  --color-button-primary-start: #a855f7;
  --color-button-primary-end: #ec4899;
  --color-button-hover-start: #9333ea;
  --color-button-hover-end: #db2777;
  --color-button-outline-bg: rgba(30, 41, 59, 0.3);
  --color-button-outline-border: #334155;
  --color-button-outline-hover: #475569;
  --color-input-bg: rgba(15, 23, 42, 0.5);
  --color-input-border: #334155;
  --color-input-text: #ffffff;
  --color-input-placeholder: rgba(255, 255, 255, 0.5);
  --color-error: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-purple: #a855f7;
  --color-pink: #ec4899;
  --color-blue: #3b82f6;
  --color-cyan: #06b6d4;
  --color-yellow: #eab308;
  --color-orange: #f97316;
  --border-radius-sm: 0.25rem;
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(
    to bottom right,
    var(--color-background-gradient-start),
    var(--color-background-gradient-middle),
    var(--color-background-gradient-end)
  );
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

p {
  margin-bottom: 1rem;
}

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

a:hover {
  color: var(--color-text);
}

.text-center {
  text-align: center;
}

.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;
}

/* Header */
.header {
  border-bottom: 1px solid var(--color-border);
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
}

.header-content {
  display: flex;
  height: 4rem;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(to bottom right, var(--color-purple), var(--color-pink));
}

.logo-icon i {
  color: white;
  width: 1.25rem;
  height: 1.25rem;
}

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

.user-info {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.username {
  font-weight: 500;
  color: var(--color-text);
}

.role-badge {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #1e293b;
  border: 1px solid #334155;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--color-text);
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-icon i {
  width: 1rem;
  height: 1rem;
}

.main-nav {
  display: none;
}

@media (min-width: 768px) {
  .main-nav {
    display: flex;
    gap: 1.5rem;
  }

  .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
  }
}

/* Footer */
.footer {
  border-top: 1px solid var(--color-border);
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  padding: 1rem 0;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--color-text-muted);
}

.footer-nav {
  display: flex;
  gap: 1rem;
}

@media (min-width: 640px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 3rem 0;
}

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

.login-card {
  width: 100%;
  max-width: 24rem;
}

.auth-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 9999px;
  background: linear-gradient(to bottom right, var(--color-purple), var(--color-pink));
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-icon i {
  width: 1.5rem;
  height: 1.5rem;
  color: white;
}

/* Dashboard */
.dashboard-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
}

.dashboard-content {
  width: 100%;
  max-width: 32rem;
  text-align: center;
}

.dashboard-title {
  margin-bottom: 2rem;
}

.dashboard-title h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

@media (min-width: 768px) {
  .dashboard-title h1 {
    font-size: 3.75rem;
  }
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 24rem;
  margin: 0 auto 2rem;
}

.launcher-button {
  height: 4rem;
  width: 100%;
  background-color: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--color-button-outline-border);
  border-radius: var(--border-radius);
  color: var(--color-text);
  backdrop-filter: blur(8px);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.launcher-button:hover {
  background-color: rgba(71, 85, 105, 0.4);
}

.launcher-button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.launcher-button-content i {
  width: 1.25rem;
  height: 1.25rem;
}

.launcher-button-content span {
  font-size: 0.75rem;
  font-weight: 500;
}

.dashboard-description {
  text-align: center;
  margin-top: 2rem;
}

.dashboard-description p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 24rem;
  margin: 0 auto 0.5rem;
}

.dashboard-description .tagline {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

/* Cards */
.card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--border-radius);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 0.5rem;
}

.card-header-with-action {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-title {
  color: var(--color-text);
}

.card-description {
  color: var(--color-text-subtle);
  font-size: 0.875rem;
}

.card-content {
  padding: 1rem 1.5rem 1.5rem;
}

.card-footer {
  padding: 1rem 0 0;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-input-text);
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-purple);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  padding-right: 2rem;
}

.password-input {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 0.75rem;
  background: transparent;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: var(--transition);
}

.password-toggle:hover {
  color: var(--color-text-muted);
}

.password-toggle i {
  width: 1rem;
  height: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn i {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
}

.btn-primary {
  background: linear-gradient(to right, var(--color-button-primary-start), var(--color-button-primary-end));
  color: white;
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(to right, var(--color-button-hover-start), var(--color-button-hover-end));
}

.btn-outline {
  background-color: var(--color-button-outline-bg);
  border: 1px solid var(--color-button-outline-border);
  color: var(--color-text-muted);
}

.btn-outline:hover {
  background-color: var(--color-button-outline-hover);
  color: var(--color-text);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Admin Page */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.admin-header h1 {
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.admin-header p {
  color: var(--color-text-subtle);
  margin-bottom: 0;
}

/* Tabs */
.tabs {
  margin-bottom: 2rem;
}

.tabs-list {
  display: flex;
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.tab-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.tab-trigger i {
  width: 1rem;
  height: 1rem;
}

.tab-trigger.active {
  background-color: #475569;
  color: var(--color-text);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card .card-header {
  padding-bottom: 0.5rem;
}

.stat-card .card-header h3 {
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.stat-card .card-header p {
  color: var(--color-text-subtle);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.stat-number {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-description {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  margin-bottom: 0;
}

.stat-status {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-purple);
}

/* List Container */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background-color: rgba(15, 23, 42, 0.3);
}

.list-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.list-item-image {
  width: 3rem;
  height: 3rem;
  border-radius: var(--border-radius-sm);
  background-color: #1e293b;
  overflow: hidden;
}

.list-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-item-info h3 {
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.list-item-info p {
  font-size: 0.875rem;
  color: var(--color-text-subtle);
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20rem;
}

.list-item-actions {
  display: flex;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  text-align: center;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--border-radius);
  background: linear-gradient(to bottom right, var(--color-purple), var(--color-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.empty-icon.yellow {
  background: linear-gradient(to bottom right, var(--color-yellow), var(--color-orange));
}

.empty-icon i {
  width: 2rem;
  height: 2rem;
  color: white;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--color-text-subtle);
  margin-bottom: 1.5rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: none;
}

.modal.active {
  display: block;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-container {
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 32rem;
  width: 90%;
  background-color: #1e293b;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  margin-bottom: 1.5rem;
  position: relative;
}

.modal-header h2 {
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.modal-header p {
  color: var(--color-text-subtle);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close i {
  width: 1rem;
  height: 1rem;
}

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .modal-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* File Upload */
.file-upload {
  border: 1px dashed var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.3);
}

.file-upload-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.file-upload-icon i {
  width: 2rem;
  height: 2rem;
  color: #64748b;
}

.file-upload-label {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  cursor: pointer;
}

.file-upload-text {
  color: var(--color-purple);
}

.file-upload-text:hover {
  color: var(--color-text);
}

.file-input {
  display: none;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  background-color: #1e293b;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-top: 0.5rem;
  width: fit-content;
}

.file-preview i {
  width: 1rem;
  height: 1rem;
}

.file-preview i:first-child {
  color: var(--color-success);
}

.file-name {
  color: var(--color-text-muted);
}

.file-remove {
  color: var(--color-text-subtle);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-remove:hover {
  color: var(--color-text-muted);
}

/* Games Page */
.games-section {
  padding: 3rem 0 6rem;
}

.games-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.games-header h1 {
  background: linear-gradient(to right, white, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.games-header p {
  color: var(--color-text-muted);
  margin-bottom: 0;
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.game-card {
  overflow: hidden;
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  box-shadow: var(--shadow-lg);
}

.game-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: rgba(15, 23, 42, 0.5);
}

.game-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover .game-image img {
  transform: scale(1.05);
}

.game-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.game-content h3 {
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.game-content p {
  color: var(--color-text-subtle);
  font-size: 0.875rem;
  margin-bottom: 0;
  flex-grow: 1;
}

/* Loading State */
.loading-state {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
  color: var(--color-text-subtle);
}

/* Utilities */
.hidden {
  display: none !important;
}

.mt-4 {
  margin-top: 1rem;
}

.error-message {
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-bottom: 1rem;
}

.error-message p {
  font-size: 0.875rem;
  font-weight: 500;
  color: #f87171;
  margin-bottom: 0;
}

.text-sm {
  font-size: 0.875rem;
}
