/*
 * Wonder Platform - Common Styles
 * Shared components and utilities
 * Version: 1.0
 */

/* ============================================
   BASE STYLES & RESET
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-semibold);
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--accent-sentinel);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.8;
}

/* Monospace for data */
.mono, .data-value, .metric-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Text utilities */
.text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-lg);
}

/* Flexbox utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Grid utilities */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   CARDS & PANELS
   ============================================ */

.card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* ============================================
   BUTTONS - INDUSTRIAL STYLE
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    background: transparent;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    opacity: 0.9;
    border-color: var(--text-secondary);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Button variants */
.btn-primary {
    background: var(--accent-sentinel);
    border-color: var(--accent-sentinel);
    color: var(--bg-primary);
}

.btn-primary:hover:not(:disabled) {
    background: transparent;
    color: var(--accent-sentinel);
}

.btn-danger {
    background: var(--status-critical);
    border-color: var(--status-critical);
    color: #ffffff;
}

.btn-accent {
    background: var(--accent-sentinel);
    border-color: var(--accent-sentinel);
    color: #000000;
    font-weight: 600;
}

.btn-accent:hover:not(:disabled) {
    background: #00BBEE;
    border-color: #00BBEE;
    color: #000000;
    opacity: 1.0;
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-base);
}

/* Icon buttons */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-button:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* ============================================
   FORM CONTROLS - INDUSTRIAL
   ============================================ */

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-primary);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-sentinel);
    box-shadow: 0 0 0 1px var(--accent-sentinel);
}

input:disabled, select:disabled, textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* ============================================
   STATUS INDICATORS - INDUSTRIAL LED STYLE
   ============================================ */

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.operational {
    background: var(--status-operational);
    box-shadow: 0 0 8px var(--status-operational);
}

.status-indicator.warning {
    background: var(--status-warning);
    box-shadow: 0 0 8px var(--status-warning);
}

.status-indicator.critical {
    background: var(--status-critical);
    box-shadow: 0 0 8px var(--status-critical);
}

.status-indicator.offline {
    background: var(--status-offline);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.badge.operational {
    background: var(--status-operational);
    color: var(--bg-primary);
}

.badge.warning {
    background: var(--status-warning);
    color: var(--bg-primary);
}

.badge.critical {
    background: var(--status-critical);
    color: #ffffff;
}

.badge.offline {
    background: var(--status-offline);
    color: var(--text-muted);
}

.badge.online {
    background: var(--status-operational);
    color: var(--bg-primary);
}

.badge.coming-soon {
    background: var(--status-offline);
    color: var(--text-secondary);
}

/* ============================================
   PROGRESS BARS
   ============================================ */

.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-sentinel);
    transition: width 0.6s ease;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent-sentinel);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* ============================================
   TABLES - INDUSTRIAL GRID
   ============================================ */

.data-table {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-collapse: collapse;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-strong);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */

.alert {
    padding: var(--space-lg);
    border-left: 4px solid;
    margin-bottom: var(--space-md);
}

.alert-info {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-sentinel);
    color: var(--text-primary);
}

.alert-warning {
    background: rgba(255, 184, 0, 0.1);
    border-color: var(--status-warning);
    color: var(--text-primary);
}

.alert-critical {
    background: rgba(255, 62, 62, 0.1);
    border-color: var(--status-critical);
    color: var(--text-primary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Spacing */
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

/* Width */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Visibility */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
