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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #334155;
    --text-light: #64748b;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--darker);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px var(--shadow);
}

.logo {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav {
    padding: 20px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: white;
    border-left-color: var(--primary);
}

.nav-item .icon {
    font-size: 1.3rem;
    margin-right: 12px;
    width: 30px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: white;
    padding: 25px 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px var(--shadow);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark);
}

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

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--light);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

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

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

.pages {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px var(--shadow);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--dark);
}

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

/* Forms */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

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

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: var(--light);
    color: var(--text);
}

.btn-small:hover {
    background: var(--border);
}

/* Result Messages */
.result-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    display: none;
}

.result-message.show {
    display: block;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.result-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

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

.node-card {
    background: var(--light);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.node-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.node-card.online {
    border-color: var(--success);
}

.node-card.offline {
    border-color: var(--text-light);
    opacity: 0.6;
}

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

.node-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
}

.node-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.node-status.online {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.node-status.offline {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-light);
}

.node-info {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
}

.history-table tr:hover {
    background: var(--light);
}

.status-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-tag.sent {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

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

.status-tag.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

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

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px var(--shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .nav-item span:not(.icon) {
        display: none;
    }

    .logo h2 {
        font-size: 1.5rem;
        text-align: center;
    }

    .pages {
        padding: 20px;
    }

    .header {
        padding: 20px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .nodes-grid {
        grid-template-columns: 1fr;
    }
}
