/* ============================================================
   Push Pixegoo - Estilos CSS Minimalistas y Adaptados a iPhone
   ============================================================ */

:root {
    --bg-main: #0b0f19;
    --bg-card: #151d2f;
    --bg-input: #1e293b;
    --border-color: #334155;
    --border-focus: #38bdf8;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-active: #075985;
    --success-bg: rgba(16, 185, 129, 0.15);
    --success-border: #10b981;
    --success-text: #34d399;
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-border: #ef4444;
    --error-text: #f87171;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-border: #f59e0b;
    --warning-text: #fbbf24;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 20px) 16px env(safe-area-inset-bottom, 24px) 16px;
}

.container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header & Navegación */
header.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #0284c7, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

nav.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

nav.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

nav.nav-links a:hover,
nav.nav-links a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* Tarjeta Principal */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: -12px;
    margin-bottom: 20px;
}

/* Formularios */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.label-hint {
    font-size: 0.82rem;
    font-weight: normal;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 14px 16px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px; /* 16px evita zoom automático indeseado en Safari iOS */
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Botones Grandes (Cómodos para Pulgar en iPhone) */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-outline {
    background-color: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Contador de dispositivos */
.device-counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
}

.badge-dot.offline {
    background-color: #ef4444;
}

/* Banners de Notificaciones y Alertas */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    line-height: 1.45;
}

.alert-success {
    background-color: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.alert-error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.alert-warning {
    background-color: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
}

/* Instrucciones Especiales iOS */
.ios-instructions {
    background-color: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.ios-instructions h4 {
    color: #38bdf8;
    font-size: 1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ios-instructions ol {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
    color: #cbd5e1;
}

.ios-instructions ol li strong {
    color: #ffffff;
}

/* Tablas y Listas de Dispositivos */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.device-name-text {
    font-size: 1.05rem;
    font-weight: 600;
}

.device-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.device-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-small-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #f87171;
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-small-danger:hover {
    background: #dc2626;
    color: #ffffff;
}

/* Diagnósticos */
.diag-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.diag-label {
    font-size: 0.95rem;
    font-weight: 500;
}

.diag-status {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 3px 10px;
    border-radius: 12px;
}

.diag-ok {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.diag-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Footer */
footer.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;
    padding-top: 24px;
}

/* Spinner de carga */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
