/* Global Styles */
:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-dark: #0f172a;
    --bg-medium: #1e293b;
    --bg-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #475569;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

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

.logo-image {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-medium);
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background: var(--success-color);
}

.status-dot.error {
    background: var(--danger-color);
}

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

/* Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Panel Styles */
.panel {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.panel h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.panel h2 i {
    color: var(--primary-color);
}


.panel h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

/* Button Styles */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
}

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn-info {
    background: var(--info-color);
    color: white;
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}


/* Configuration Status */
.config-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.config-status-display {
    flex: 1;
}

.config-status-display.configured span {
    color: var(--success-color);
}

.config-status-display.configured i {
    color: var(--success-color);
}

.config-status-display span {
    color: var(--warning-color);
    font-weight: 500;
}

.config-status-display i {
    color: var(--warning-color);
    margin-right: 8px;
}

/* Search Controls */
.search-controls {
    margin-bottom: 25px;
    width: 100%;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
    width: 100%;
    /* Fallback for older browsers */
    display: -webkit-grid;
    -webkit-grid-template-columns: repeat(2, 1fr);
    -webkit-grid-gap: 10px;
}

/* Fallback using flexbox for very old browsers */
@supports not (display: grid) {
    .button-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .button-grid .btn {
        flex: 1 1 calc(50% - 5px);
        min-width: calc(50% - 5px);
    }
}

.button-grid .btn {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    flex-shrink: 0;
}

/* Task List */
.task-list {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.task-item {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-medium);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.task-item:hover {
    background: var(--bg-light);
}

.task-item:last-child {
    margin-bottom: 0;
}

/* Cloud Controls */
.cloud-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.server-control {
    margin-top: 20px;
}

/* Results Container */

.results-container {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    margin-bottom: 12px;
    background: var(--bg-medium);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.result-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-row {
    display: flex;
    margin-bottom: 8px;
    align-items: flex-start;
}

.result-row:last-child {
    margin-bottom: 0;
}

.result-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.result-value {
    font-family: 'Courier New', monospace;
    word-break: break-all;
    flex: 1;
    font-size: 0.85rem;
}

.result-address {
    color: var(--primary-color);
    font-weight: 500;
}

.result-private-key {
    color: var(--success-color);
}

.result-public-key {
    color: var(--info-color);
}

/* Console Panel */
.console-panel {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.console {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.console-entry {
    margin-bottom: 5px;
    color: var(--text-secondary);
}

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

.console-entry.success {
    color: var(--success-color);
}

.console-entry.info {
    color: var(--info-color);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-medium);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.modal-task-list {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.config-form {
    margin-top: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: flex-end;
}

.modal-actions .btn {
    min-width: 120px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .cloud-controls {
        grid-template-columns: 1fr;
    }
    
    .task-actions {
        flex-direction: column;
    }
    
    
    header {
        flex-direction: column;
        gap: 20px;
    }
}

/* Container Status Styles */
.container-status-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.container-status-display {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.status-loading {
    text-align: center;
    color: #888;
}

.container-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    background: #2a2a2a;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.stat-value.ready {
    color: #4ecdc4;
}

.stat-value.deploying {
    color: #f39c12;
}

.stat-value.failed {
    color: #e74c3c;
}

.container-details {
    background: #2a2a2a;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #333;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #888;
}

.detail-value {
    color: #fff;
    font-weight: 500;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 6px;
}