/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #4895ef;
    --dark: #212529;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 25px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 50%;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.domain-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    display: inline-block;
}

.status-dot.online { background: #4ade80; animation: pulse 2s infinite; }
.status-dot.offline { background: #f87171; }
.status-dot.connecting { background: #fbbf24; animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border-left: 5px solid;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.stat-card.green { border-left-color: var(--success); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card.blue { border-left-color: var(--info); }

.stat-icon {
    background: linear-gradient(135deg, currentColor, transparent);
    padding: 20px;
    border-radius: 12px;
    color: white;
    font-size: 1.8rem;
}

.stat-card.green .stat-icon { background: linear-gradient(135deg, var(--success), #3a9bc5); }
.stat-card.red .stat-icon { background: linear-gradient(135deg, var(--danger), #d42e7c); }
.stat-card.blue .stat-icon { background: linear-gradient(135deg, var(--info), #3a7bc5); }

.stat-content h3 {
    font-size: 0.95rem;
    color: var(--gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-trend {
    font-size: 0.85rem;
    color: var(--gray);
}

/* CONTROL PANEL */
.control-panel {
    padding: 0 30px 30px;
}

.control-panel h2 {
    margin-bottom: 25px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.btn-control {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-control:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.btn-control i {
    font-size: 2.2rem;
    margin-bottom: 5px;
}

.btn-control span {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-control small {
    font-size: 0.85rem;
    color: var(--gray);
    opacity: 0.8;
}

.btn-primary { border-color: var(--primary); color: var(--primary); }
.btn-warning { border-color: var(--warning); color: var(--warning); }
.btn-info { border-color: var(--info); color: var(--info); }
.btn-danger { border-color: var(--danger); color: var(--danger); }

.btn-primary:hover { background: var(--primary); color: white; }
.btn-warning:hover { background: var(--warning); color: white; }
.btn-info:hover { background: var(--info); color: white; }
.btn-danger:hover { background: var(--danger); color: white; }

/* LOGS SECTION */
.logs-section {
    padding: 0 30px 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
}

.last-update {
    background: var(--light);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logs-container {
    background: var(--light);
    border-radius: var(--radius);
    padding: 25px;
    min-height: 300px;
    position: relative;
}

.logs-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: var(--gray);
}

.logs-placeholder i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.log-entry {
    background: white;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-entry.granted { border-left-color: var(--success); }
.log-entry.denied { border-left-color: var(--danger); }
.log-entry.system { border-left-color: var(--info); }

.log-time {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--dark);
    min-width: 80px;
}

.log-uid {
    font-family: 'Courier New', monospace;
    background: var(--light);
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--dark);
    flex-grow: 1;
    margin: 0 15px;
}

.log-status {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-entry.granted .log-status { background: rgba(76, 201, 240, 0.1); color: var(--success); }
.log-entry.denied .log-status { background: rgba(247, 37, 133, 0.1); color: var(--danger); }
.log-entry.system .log-status { background: rgba(72, 149, 239, 0.1); color: var(--info); }

/* SYSTEM INFO & FOOTER */
.system-info {
    background: var(--light);
    margin: 0 30px 30px;
    padding: 25px;
    border-radius: var(--radius);
}

.system-info h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.info-label {
    font-weight: 600;
    color: var(--gray);
}

.info-value {
    font-family: 'Courier New', monospace;
    color: var(--dark);
}

.footer {
    text-align: center;
    padding: 25px 30px;
    color: var(--gray);
    border-top: 1px solid var(--border);
}

.footer-note {
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0.7;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal h3 {
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--gray);
    font-size: 0.85rem;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .domain-info {
        align-items: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .button-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .log-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .log-uid {
        margin: 10px 0;
        width: 100%;
    }
}