/* ============================================
   ATIVUS CONTROL PANEL - COMPONENTS
   ============================================ */

/* ============================================
   HEADER / NAVBAR
   ============================================ */

.header {
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--gray-50);
}

.logo-icon {
    font-size: var(--text-3xl);
}

.logo-image {
    height: 32px;
    width: auto;
    filter: brightness(1.1);
    transition: all var(--transition-base);
}

.logo-image:hover {
    filter: brightness(1.3);
    transform: scale(1.05);
}

.nav-link {
    color: var(--gray-400);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-size: var(--text-sm);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--gray-100);
    background: var(--glass-bg);
}

.nav-link.active {
    color: var(--primary-400);
    background: rgba(139, 92, 246, 0.1);
}

/* ============================================
   BUTTONS (Apple Style)
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border-radius: 9999px;
    /* Pill shape */
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 36px;
    /* Consistent height */
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-primary {
    background: rgba(0, 122, 255, 0.8);
    /* Apple Blue */
    color: white;
    border: 1px solid rgba(0, 122, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 122, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(0, 122, 255, 1);
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.btn-success {
    background: rgba(52, 199, 89, 0.15);
    /* Apple Green Tint */
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.btn-success:hover:not(:disabled) {
    background: rgba(52, 199, 89, 0.25);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(52, 199, 89, 0.2);
}

.btn-danger {
    background: rgba(255, 59, 48, 0.1);
    /* Apple Red Tint */
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.2);
}

.btn-warning {
    background: rgba(255, 149, 0, 0.1);
    /* Apple Orange Tint */
    color: #ff9500;
    border: 1px solid rgba(255, 149, 0, 0.3);
}

.btn-warning:hover:not(:disabled) {
    background: rgba(255, 149, 0, 0.2);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(255, 149, 0, 0.2);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gray-300);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: scale(1.02);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    height: 28px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    /* Circle */
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
}

.card-header {
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-50);
    margin-bottom: var(--space-1);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--gray-400);
}

.card-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* ============================================
   STATUS BADGE
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.running {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-400);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.stopped {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-400);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.starting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-400);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-300);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.status-badge.deploying {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Status Indicator Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.running {
    background: var(--success-400);
    box-shadow: 0 0 10px var(--success-400);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.stopped {
    background: var(--error-400);
}

.status-dot.starting {
    background: var(--warning-400);
    animation: pulse 1s ease-in-out infinite;
}

/* ============================================
   SERVICE CARD
   ============================================ */

.service-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    transition: all var(--transition-base);
    animation: fadeIn var(--transition-base) ease-out;
}

/* Service Card Specifics */
.service-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

/* Hover Effects with Colored Glows */
.service-card.running:hover {
    border-color: rgba(16, 185, 129, 0.5);
    /* Green */
    box-shadow:
        0 4px 20px -5px rgba(16, 185, 129, 0.1),
        0 10px 40px -10px rgba(16, 185, 129, 0.2);
    /* Beautiful sparse green glow */
    transform: translateY(-4px);
}

.service-card.starting:hover {
    border-color: rgba(245, 158, 11, 0.5);
    /* Orange */
    box-shadow:
        0 4px 20px -5px rgba(245, 158, 11, 0.1),
        0 10px 40px -10px rgba(245, 158, 11, 0.2);
    transform: translateY(-4px);
}

.service-card.stopped:hover {
    border-color: rgba(239, 68, 68, 0.4);
    /* Red */
    box-shadow:
        0 4px 20px -5px rgba(239, 68, 68, 0.1),
        0 10px 40px -10px rgba(239, 68, 68, 0.15);
    transform: translateY(-4px);
}

/* Subtle gradient background based on state */
.service-card.running::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--success-500), transparent);
    opacity: 0.5;
}

.service-card.starting::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--warning-500), transparent);
    opacity: 0.5;
}

.service-card.stopped::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--error-500), transparent);
    opacity: 0.2;
}

.service-card.deploying {
    animation: deployPulse 1.6s ease-in-out infinite;
}

@keyframes deployPulse {
    0% {
        box-shadow: 0 0 0 rgba(245, 158, 11, 0.0);
    }
    50% {
        box-shadow:
            0 0 18px rgba(245, 158, 11, 0.35),
            0 0 40px rgba(245, 158, 11, 0.2);
    }
    100% {
        box-shadow: 0 0 0 rgba(245, 158, 11, 0.0);
    }
}

.service-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.service-info {
    flex: 1;
}

.service-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-50);
    margin-bottom: var(--space-1);
}

.service-description {
    font-size: var(--text-sm);
    color: var(--gray-400);
    margin-bottom: var(--space-2);
}

.service-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.service-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.service-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ============================================
   LOG VIEWER
   ============================================ */

.log-viewer {
    background: #0D1117;
    border: 1px solid var(--gray-800);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: var(--text-sm);
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    color: var(--gray-300);
}

.log-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-800);
}

.log-viewer-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-400);
    font-family: 'Inter', sans-serif;
}

.log-line {
    padding: var(--space-1) 0;
    word-wrap: break-word;
}

.log-line:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Log colors */
.log-info {
    color: var(--info-400);
}

.log-warn {
    color: var(--warning-400);
}

.log-error {
    color: var(--error-400);
}

.log-success {
    color: var(--success-400);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal {
    background: var(--gray-900);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    box-shadow: var(--shadow-2xl);
    animation: fadeIn var(--transition-slow) ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: var(--space-6) var(--space-6) var(--space-4);
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-50);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6) var(--space-6);
    flex-shrink: 0;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-300);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3);
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: var(--radius-md);
    color: var(--gray-100);
    font-size: var(--text-sm);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: var(--gray-900);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-width: 300px;
    box-shadow: var(--shadow-xl);
    animation: fadeIn var(--transition-base) ease-out;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toast.success {
    border-left: 4px solid var(--success-500);
}

.toast.error {
    border-left: 4px solid var(--error-500);
}

.toast.info {
    border-left: 4px solid var(--info-500);
}

.toast-message {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--gray-100);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--space-10);
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--gray-400);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ============================================
   HERO BUTTONS
   ============================================ */

.btn-hero {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: var(--space-3) var(--space-6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(139, 92, 246, 0.2),
        0 0 15px rgba(139, 92, 246, 0.3);
    /* Base Glow */
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-hero svg {
    margin-right: -2px;
    /* Visual balance */
    transition: transform 0.3s ease;
}

.btn-hero:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.2),
        0 4px 6px -2px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(167, 139, 250, 0.4),
        0 0 25px rgba(139, 92, 246, 0.6);
    /* Intensified Glow */
}

.btn-hero:hover svg {
    transform: rotate(90deg) scale(1.1);
}

.btn-hero:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Shine Effect */
.btn-hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
    pointer-events: none;
}

.btn-hero:hover::after {
    transition: 0.7s;
}

/* ============================================
   STATUS BADGE & FLOATING UI
   ============================================ */

.status-widget {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transition: all var(--transition-base);
}

.status-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    border-color: var(--gray-600);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-400);
    padding-right: var(--space-3);
    border-right: 1px solid var(--gray-700);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--gray-600);
    transition: background-color 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.status-widget.connected .status-dot {
    background-color: var(--success-500);
    box-shadow: 0 0 10px var(--success-500);
}

.status-widget.connected .status-text {
    color: var(--success-400);
}

.status-widget.disconnected .status-dot {
    background-color: var(--error-500);
    box-shadow: 0 0 10px var(--error-500);
    animation: pulse 1s infinite;
}

.status-widget.disconnected .status-text {
    color: var(--error-400);
}

.logout-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--gray-400);
    transition: all 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.logout-btn-icon:hover {
    background: var(--error-500);
    color: white;
    transform: rotate(90deg);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hide original header status if needed */
.header-status-original {
    display: none !important;
}

/* Header Specific Actions */
.logo {
    white-space: nowrap;
    /* Prevent title wrapping */
}

.logout-btn-header {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.logout-btn-header:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-400);
}

.status-dot-header {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--gray-600);
    transition: all 0.3s;
}

.header-connected .status-dot-header {
    background-color: var(--success-500);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
    animation: pulse 2s infinite;
    /* Added pulse to connected state */
}

.header-disconnected .status-dot-header {
    background-color: var(--error-500);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    animation: pulse 1s infinite;
}
