/* ============================================
   AUTOMATION COMMAND CENTER - STYLES
   Premium Dark Mode Dashboard
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: rgba(26, 26, 36, 0.8);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    
    --accent-primary: #00d4ff;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --glow: 0 0 20px rgba(0, 212, 255, 0.3);
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 72px;
    --radius: 12px;
    --radius-sm: 8px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
    font-size: 28px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--glow);
}

.nav-icon {
    font-size: 20px;
}

.nav-label {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: blink 2s ease-in-out infinite;
}

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

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
}

.top-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Sections */
.section {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.view-all {
    font-size: 13px;
    color: var(--accent-primary);
    text-decoration: none;
}

.view-all:hover {
    text-decoration: underline;
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-4px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.success { background: rgba(16, 185, 129, 0.15); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.15); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.15); }
.stat-icon.info { background: rgba(59, 130, 246, 0.15); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-trend {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 20px;
}

.stat-trend.up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.action-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--glow);
}

.action-icon {
    font-size: 32px;
}

.action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.action-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   ACTIVITY LIST
   ============================================ */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.activity-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.activity-status {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.activity-item.success .activity-status {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.activity-item.failed .activity-status {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.activity-item.pending .activity-status {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.project-tag {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.error-msg {
    color: var(--danger);
}

/* ============================================
   AUTOMATIONS GRID
   ============================================ */

.automations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.automation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}

.automation-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
}

.automation-card.disabled {
    opacity: 0.5;
}

.automation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.automation-icon {
    font-size: 32px;
}

.automation-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.automation-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.automation-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.automation-actions {
    display: flex;
    gap: 8px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    transition: var(--transition);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ============================================
   PROJECTS GRID
   ============================================ */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent, var(--accent-primary));
}

.project-card:hover {
    border-color: var(--accent, var(--accent-primary));
    transform: translateY(-4px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.project-icon {
    font-size: 28px;
}

.project-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.project-status.online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.project-status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.project-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.project-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.project-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.project-stat {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent, var(--accent-primary));
}

.stat-lbl {
    font-size: 11px;
    color: var(--text-muted);
}

.project-link {
    font-size: 13px;
    color: var(--accent-primary);
    text-decoration: none;
}

.project-link:hover {
    text-decoration: underline;
}

/* ============================================
   LOGS TABLE
   ============================================ */

.log-filters {
    display: flex;
    gap: 12px;
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.logs-table {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

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

th, td {
    padding: 16px 20px;
    text-align: left;
}

th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr {
    border-bottom: 1px solid var(--border-color);
}

tr:last-child {
    border-bottom: none;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.log-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.log-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.log-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ============================================
   SETTINGS
   ============================================ */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.connection-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.connection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.conn-icon {
    font-size: 20px;
}

.conn-name {
    flex: 1;
    font-size: 14px;
}

.conn-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
}

.connection-item.connected .conn-status {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.connection-item.disconnected .conn-status {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.setting-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-option:last-child {
    border-bottom: none;
}

.setting-option span {
    font-size: 14px;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .top-header {
        padding: 0 16px;
    }
    
    .section {
        padding: 16px;
    }
}
