/**
 * PatriotCompass Admin Console - Component Styles
 * 
 * Reusable component styles following the design system.
 * This file is kept under 1000 lines per CSS modularity standards.
 * 
 * Components:
 * 1. Buttons
 * 2. Form Controls
 * 3. Cards
 * 4. Badges
 * 5. Loading States
 * 6. Tooltips
 */

/* ============================================
   1. BUTTON SYSTEM
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Sizes */
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 17px;
  border-radius: 10px;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--patriot-white);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-lg), var(--shadow-focus-blue);
}

/* Secondary Button */
.btn-secondary {
  background: var(--patriot-white);
  color: var(--patriot-blue);
  border: 2px solid var(--patriot-blue);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--slate-50);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active:not(:disabled) {
  background: var(--slate-100);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-blue);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--slate-700);
  border: none;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--slate-100);
  color: var(--patriot-blue);
}

.btn-ghost:active:not(:disabled) {
  background: var(--slate-200);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--patriot-white);
  box-shadow: var(--shadow-md);
}

.btn-success:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-success:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Warning Button */
.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: var(--patriot-white);
  box-shadow: var(--shadow-md);
}

.btn-warning:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-warning:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Danger Button */
.btn-danger {
  background: var(--gradient-error);
  color: var(--patriot-white);
  box-shadow: var(--shadow-md);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-danger:focus-visible {
  outline: none;
  box-shadow: var(--shadow-lg), var(--shadow-focus-red);
}

/* Success Button */
.btn-success {
  background: var(--gradient-success);
  color: var(--patriot-white);
  box-shadow: var(--shadow-md);
}

.btn-success:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-success:focus-visible {
  outline: none;
  box-shadow: var(--shadow-lg), var(--shadow-focus-green);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--slate-100);
  color: var(--slate-700);
}

.btn-icon:hover:not(:disabled) {
  background: var(--slate-200);
  color: var(--patriot-blue);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
}

.btn-icon-lg {
  width: 48px;
  height: 48px;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  height: var(--button-height-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  height: var(--button-height-lg);
}

/* Button with Icon */
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-with-icon svg,
.btn-with-icon i {
  width: 1.25em;
  height: 1.25em;
}


/* ============================================
   2. FORM CONTROLS
   ============================================ */

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  color: var(--slate-700);
  margin-bottom: var(--space-2);
}

.form-label-required::after {
  content: ' *';
  color: var(--error-red);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--slate-700);
  background: var(--patriot-white);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  transition: var(--transition-colors);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--slate-300);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--patriot-blue);
  box-shadow: var(--shadow-focus-blue);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--slate-100);
  color: var(--slate-400);
  cursor: not-allowed;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--slate-400);
}

/* Input Sizes */
.form-input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  height: var(--input-height-sm);
}

.form-input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  height: var(--input-height-lg);
}

/* Textarea */
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-colors);
}

.form-radio {
  border-radius: var(--radius-full);
}

.form-checkbox:checked,
.form-radio:checked {
  background: var(--patriot-blue);
  border-color: var(--patriot-blue);
}

.form-checkbox:focus,
.form-radio:focus {
  outline: none;
  box-shadow: var(--shadow-focus-blue);
}

/* Checkbox/Radio Label */
.form-check-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

/* Form Helper Text */
.form-help {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--slate-500);
}

/* Form Error */
.form-error {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--error-red);
}

.form-input-error,
.form-select-error,
.form-textarea-error {
  border-color: var(--error-red);
}

.form-input-error:focus,
.form-select-error:focus,
.form-textarea-error:focus {
  box-shadow: var(--shadow-focus-red);
}


/* ============================================
   3. CARD COMPONENTS
   ============================================ */

.card {
  background: var(--patriot-white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
  transition: var(--transition-all);
}

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

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--slate-200);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--slate-700);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--slate-500);
  margin-top: var(--space-1);
}

/* Card Body */
.card-body {
  color: var(--slate-600);
  line-height: var(--leading-relaxed);
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--slate-200);
}

/* Card Variants */
.card-flat {
  box-shadow: none;
  border: 1px solid var(--slate-200);
}

.card-elevated {
  box-shadow: var(--shadow-xl);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-lg);
}


/* ============================================
   4. BADGE COMPONENTS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Status Badges */
.badge-approved {
  background: #d1fae5;
  color: #065f46;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* Source Badges */
.badge-source {
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge-pexels {
  background: rgba(5, 160, 129, 0.1);
  color: var(--source-pexels);
}

.badge-pixabay {
  background: rgba(46, 204, 113, 0.1);
  color: var(--source-pixabay);
}

.badge-wikimedia {
  background: rgba(52, 152, 219, 0.1);
  color: var(--source-wikimedia);
}

.badge-nasa {
  background: rgba(102, 126, 234, 0.1);
  color: var(--source-nasa);
}

.badge-nps {
  background: rgba(86, 171, 47, 0.1);
  color: var(--source-nps);
}

.badge-unsplash {
  background: rgba(0, 0, 0, 0.1);
  color: var(--source-unsplash);
}

/* Badge Sizes */
.badge-sm {
  padding: 0 var(--space-2);
  font-size: 0.625rem; /* 10px */
}

.badge-lg {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* Badge with Dot */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}


/* ============================================
   5. LOADING STATES
   ============================================ */

/* Spinner */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--slate-200);
  border-top-color: var(--patriot-blue);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

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

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.spinner-lg {
  width: 2rem;
  height: 2rem;
  border-width: 4px;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--slate-200) 0%,
    var(--slate-100) 50%,
    var(--slate-200) 100%
  );
  background-size: 200% 100%;
  animation: pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes pulse {
  0%, 100% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 0%;
  }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-2);
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 200px;
}


/* ============================================
   6. TOOLTIPS
   ============================================ */

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: var(--space-2) var(--space-3);
  background: var(--slate-900);
  color: var(--patriot-white);
  font-size: var(--text-xs);
  line-height: var(--leading-tight);
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-opacity);
  z-index: var(--z-tooltip);
}

.tooltip:hover .tooltip-content,
.tooltip:focus .tooltip-content {
  opacity: 1;
}

.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--slate-900);
}

/* Tooltip Positions */
.tooltip-top .tooltip-content {
  bottom: 100%;
  top: auto;
  margin-bottom: var(--space-2);
}

.tooltip-bottom .tooltip-content {
  top: 100%;
  bottom: auto;
  margin-top: var(--space-2);
  transform: translateX(-50%) translateY(8px);
}

.tooltip-left .tooltip-content {
  right: 100%;
  left: auto;
  top: 50%;
  bottom: auto;
  transform: translateX(-8px) translateY(-50%);
}

.tooltip-right .tooltip-content {
  left: 100%;
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translateX(8px) translateY(-50%);
}

/* ================================
   Google OAuth Sign-in Button
   ================================ */

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 100%;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.google-signin-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-signin-btn:active {
    background-color: #f1f3f4;
}

.google-signin-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.3);
}

.google-signin-btn svg {
    flex-shrink: 0;
}

.google-signin-btn span {
    flex-shrink: 0;
}
