/* UUDS TV Controller 2.0 - Responsive Design */

/* Small Devices */
@media (max-width: 480px) {
  .uuds-admin-container {
    padding: 12px;
  }

  .uuds-admin-header {
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 8px;
  }

  .uuds-admin-title {
    font-size: 20px;
  }

  .uuds-subtitle {
    font-size: 12px;
  }

  .uuds-version-badge {
    padding: 4px 8px;
    font-size: 10px;
  }

  .uuds-stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .uuds-stat-card {
    gap: 12px;
    padding: 12px;
  }

  .uuds-stat-icon {
    font-size: 28px;
  }

  .uuds-stat-number {
    font-size: 22px;
  }

  .uuds-admin-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .uuds-card {
    border-radius: 8px;
  }

  .uuds-card-header {
    padding: 12px;
  }

  .uuds-card-header h2 {
    font-size: 16px;
  }

  .uuds-card-body {
    padding: 12px;
  }

  .uuds-form-group {
    margin-bottom: 12px;
  }

  .uuds-form-group label {
    font-size: 13px;
  }

  .uuds-input {
    padding: 8px 10px;
    font-size: 13px;
  }

  .uuds-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .uuds-btn-lg {
    padding: 10px 16px;
    font-size: 14px;
    width: 100%;
  }

  .uuds-table th,
  .uuds-table td {
    padding: 8px;
    font-size: 12px;
  }

  .uuds-table-responsive {
    font-size: 12px;
    overflow-x: scroll;
  }

  .uuds-action-group {
    flex-wrap: wrap;
  }

  .uuds-btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }

  .uuds-control-card {
    padding: 16px;
  }

  .uuds-control-card h2 {
    font-size: 18px;
  }

  .uuds-form-col {
    min-width: 100%;
  }

  .uuds-form-row {
    flex-direction: column;
  }

  .uuds-form-col-auto {
    flex-direction: column;
    width: 100%;
  }

  .uuds-form-col-auto .uuds-btn {
    width: 100%;
    justify-content: center;
  }

  .uuds-empty-state {
    padding: 40px 12px;
  }

  .uuds-empty-icon {
    font-size: 48px;
  }
}

/* Medium Devices (481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
  .uuds-admin-container {
    padding: 16px;
  }

  .uuds-admin-header {
    padding: 16px;
    margin-bottom: 20px;
  }

  .uuds-admin-title {
    font-size: 24px;
  }

  .uuds-subtitle {
    font-size: 13px;
  }

  .uuds-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
  }

  .uuds-stat-card {
    padding: 14px;
    gap: 12px;
  }

  .uuds-stat-icon {
    font-size: 30px;
  }

  .uuds-stat-number {
    font-size: 24px;
  }

  .uuds-admin-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .uuds-card-header h2 {
    font-size: 16px;
  }

  .uuds-table th,
  .uuds-table td {
    padding: 10px;
    font-size: 13px;
  }

  .uuds-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .uuds-btn-lg {
    padding: 10px 20px;
  }

  /* Stack control page vertically */
  .uuds-form-row {
    flex-direction: column;
    gap: 8px;
  }

  .uuds-form-col-auto {
    flex-direction: row;
  }

  .uuds-form-col-auto .uuds-btn {
    flex: 1;
  }
}

/* Large Devices (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .uuds-admin-container {
    max-width: 1000px;
  }

  .uuds-admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
  }

  .uuds-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .uuds-table {
    font-size: 13px;
  }

  .uuds-table th,
  .uuds-table td {
    padding: 10px;
  }
}

/* Extra Large Devices (1025px+) */
@media (min-width: 1025px) {
  .uuds-admin-container {
    max-width: 1400px;
  }

  .uuds-admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
  }

  .uuds-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .uuds-table {
    font-size: 14px;
  }
}

/* Tablet Portrait (768px - 1024px, Portrait) */
@media (max-width: 1024px) and (max-height: 1200px) and (orientation: portrait) {
  .uuds-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .uuds-admin-grid {
    grid-template-columns: 1fr;
  }

  .uuds-form-row {
    flex-direction: column;
  }

  .uuds-form-col-auto {
    flex-direction: column;
  }
}

/* Tablet Landscape */
@media (max-width: 1024px) and (orientation: landscape) {
  .uuds-admin-container {
    padding: 12px;
  }

  .uuds-admin-header {
    margin-bottom: 16px;
  }

  .uuds-stats-grid {
    gap: 12px;
    margin-bottom: 16px;
  }

  .uuds-stat-card {
    padding: 12px;
  }

  .uuds-admin-grid {
    gap: 12px;
    margin-bottom: 16px;
  }

  .uuds-card-body,
  .uuds-card-footer {
    padding: 12px;
  }

  .uuds-table th,
  .uuds-table td {
    padding: 8px;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .uuds-btn,
  button {
    min-height: 44px;
    min-width: 44px;
  }

  input[type="text"],
  input[type="url"],
  select {
    min-height: 44px;
    font-size: 16px;
  }

  .uuds-table th,
  .uuds-table td {
    padding: 10px;
  }

  .uuds-action-group {
    gap: 8px;
  }

  .uuds-btn-sm {
    min-height: 40px;
    min-width: 40px;
  }
}

/* Dark Mode (if user prefers) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-light: #1a202c;
    --color-dark: #e2e8f0;
    --color-border: #4a5568;
    --color-text: #cbd5e0;
  }

  .uuds-card,
  .uuds-control-card {
    background: #2d3748;
    color: #e2e8f0;
  }

  .uuds-card-header {
    background: #1a202c;
    border-bottom-color: #4a5568;
  }

  .uuds-table th {
    background: #1a202c;
  }

  input[type="text"],
  input[type="url"],
  input[type="email"],
  select {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  input[type="text"]:focus,
  input[type="url"]:focus,
  input[type="email"]:focus,
  select:focus {
    background: #2d3748;
  }

  .uuds-admin-header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  }

  code {
    background: #1a202c;
    color: #81e6d9;
  }

  .uuds-info-box {
    background: #2d3748;
    border-left-color: #4299e1;
  }

  .uuds-empty-state {
    color: #a0aec0;
  }
}

/* Print Friendly */
@media print {
  .uuds-admin-header,
  .uuds-btn,
  .uuds-form-group label,
  .uuds-card-header {
    display: none;
  }

  .uuds-table {
    width: 100%;
    border-collapse: collapse;
  }

  .uuds-table th,
  .uuds-table td {
    border: 1px solid #000;
    padding: 8px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .uuds-btn,
  input[type="text"],
  input[type="url"],
  select {
    border-width: 1px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .uuds-btn,
  .uuds-stat-card,
  input[type="text"],
  input[type="url"],
  select,
  .uuds-loader {
    transition: none !important;
    animation: none !important;
  }
}
