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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Status Message */
.status-message {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    display: none;
    animation: slideIn 0.3s ease-out;
}

.status-message.info {
    background-color: #2196F3;
}

.status-message.success {
    background-color: #4CAF50;
}

.status-message.error {
    background-color: #f44336;
}

.status-message.warning {
    background-color: #ff9800;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Top Navigation Bar */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-left h1 {
    font-size: 24px;
    font-weight: 600;
}

.app-status {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

.nav-right {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* Content Area */
.content-area {
    flex: 1;
    margin-top: 60px;
    position: relative;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.view.active {
    opacity: 1;
    visibility: visible;
}

/* Dashboard View */
#dashboardView {
    padding: 40px;
    overflow-y: auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h2 {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

.dashboard-header p {
    font-size: 16px;
    color: #666;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.app-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.app-card.running {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #f0f8f0 0%, #ffffff 100%);
}

.app-card h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
}

.app-card p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

.app-card:hover {
    cursor: default;
}

/* Duration Selector Styles */
.duration-selector {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.duration-selector h4 {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
}

.duration-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.duration-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
}

.duration-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.duration-btn.permanent {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-color: #ff6b6b;
    font-weight: 600;
}

.duration-btn.permanent:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
    border-color: #ff5252;
}

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

.app-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
    color: #999;
}

.config-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.config-info code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.app-card-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.running {
    background: #4CAF50;
    color: white;
}

.status-badge.stopped {
    background: #e0e0e0;
    color: #666;
}

.dashboard-info {
    max-width: 400px;
    margin: 0 auto;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.info-card h3 {
    margin-bottom: 15px;
    color: #333;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.status-item:last-child {
    border-bottom: none;
}

.status-item .label {
    color: #666;
    font-weight: 500;
}

.status-item .value {
    color: #333;
    font-weight: 600;
}

/* App View */
#appView {
    padding: 0;
}

.app-container {
    width: 100%;
    height: 100%;
}

#appFrame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading View */
#loadingView {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.loading-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-container h2 {
    color: #333;
    margin-bottom: 10px;
}

.loading-container p {
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-bar {
        padding: 0 15px;
        height: 50px;
    }
    
    .nav-left h1 {
        font-size: 20px;
    }
    
    .content-area {
        margin-top: 50px;
    }
    
    #dashboardView {
        padding: 20px;
    }
    
    .dashboard-header h2 {
        font-size: 24px;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-left {
        gap: 15px;
    }
    
    .app-status {
        display: none;
    }
}

/* Animation for view transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view.active {
    animation: fadeIn 0.3s ease;
}