/* AxHive UI Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
}

.navbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-link:hover {
    color: #e2e8f0;
    background: #334155;
}

.nav-link.active {
    color: #e2e8f0;
    background: #334155;
}

.navbar-end {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hub-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.status-dot.connected {
    background: #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #334155;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Page Container */
.page-container {
    display: none;
}

.page-container.active {
    display: block;
}

/* View transition */
.page-container {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Form Elements */
.form-input {
    width: 100%;
    padding: 12px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-input::placeholder {
    color: #64748b;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #cbd5e1;
}

.form-label .required {
    color: #ef4444;
}

.form-label .hint {
    font-size: 11px;
    color: #64748b;
}

/* Cards */
.card {
    background: #1e293b;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #334155;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-icon {
    width: 36px;
    height: 36px;
    background: #334155;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-subtitle {
    color: #94a3b8;
    font-size: 13px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-ghost {
    background: transparent;
    color: #94a3b8;
}

.btn-ghost:hover {
    color: #e2e8f0;
}

.btn-danger {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid #dc2626;
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(220, 38, 38, 0.2);
}

.btn-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid #22c55e;
    color: #4ade80;
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.2);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-mqtt {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.badge-rest {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-connected {
    color: #4ade80;
}

.badge-disconnected {
    color: #f87171;
}

/* Status indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.status-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Grid layouts */
.space-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

/* Stat box */
.stat-box {
    background: #1e293b;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #334155;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
}

.stat-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    background: #1e293b;
    border-radius: 16px;
    border: 2px dashed #334155;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 24px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Source type selector */
.source-type-btn {
    flex: 1;
    padding: 16px;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.source-type-btn.active {
    border-color: #3b82f6;
}

.source-type-btn .icon {
    width: 40px;
    height: 40px;
    background: #334155;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.source-type-btn.active .icon {
    background: #3b82f6;
}

.source-type-btn .title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.source-type-btn .description {
    font-size: 12px;
    color: #64748b;
}

/* Alert/Status messages */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #fca5a5;
}

/* Device card */
.device-card {
    background: #1e293b;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #334155;
    transition: all 0.3s;
}

.device-card.updated {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.device-name {
    font-weight: 600;
    font-size: 13px;
}

.device-type {
    font-size: 11px;
    color: #64748b;
}

.device-id {
    font-size: 10px;
    color: #475569;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    margin-top: 2px;
    word-break: break-all;
}

.device-id-row {
    background: #0f172a;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #334155;
}

.device-id-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.device-id-value {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    word-break: break-all;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sensor-item {
    background: #0f172a;
    padding: 8px;
    border-radius: 6px;
}

.sensor-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
}

.sensor-value {
    font-size: 16px;
    font-weight: 600;
}

.device-timestamp {
    margin-top: 10px;
    font-size: 10px;
    color: #475569;
    text-align: right;
}

/* Add space card (dashed) */
.add-card {
    background: transparent;
    border: 2px dashed #334155;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: #64748b;
    transition: all 0.2s;
}

.add-card:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.add-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px dashed currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

/* Project ID field styling */
.project-id-input {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
    }
    
    .space-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}