@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

/* Reset and Base Styles */
:root {
    --bg-color: #0d1117; /* GitHub Dark */
    --card-bg: #161b22;
    --card-border: #30363d;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --accent-primary: #58a6ff;
    --accent-primary-hover: #79c0ff;
    --accent-success: #2ea043;
    --accent-success-hover: #3fb950;
    --accent-danger: #f85149;
    --accent-danger-hover: #da3633;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Layout Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeIn 0.8s ease-out;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--card-border);
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    color: var(--text-main);
}

.logo-text span {
    color: var(--accent-primary);
    font-weight: 500;
}

.greeting {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
    white-space: pre-wrap;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
main {
    flex: 1;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 30px;
    text-align: left;
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '>';
    margin-right: 10px;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-weight: bold;
}

/* Servers Grid */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

/* Cards */
.server-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 30px 25px;
    text-align: left;
    transition: all 0.2s ease;
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.server-card:nth-child(2) { animation-delay: 0.1s; }
.server-card:nth-child(3) { animation-delay: 0.2s; }
.server-card:nth-child(4) { animation-delay: 0.3s; }

.server-card:hover {
    border-color: var(--text-muted);
}

.server-icon {
    font-size: 24px;
    color: var(--accent-primary);
    margin-bottom: 15px;
    font-family: var(--font-mono);
}

.server-name {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-main);
}

.server-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.server-address {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-success);
    background: var(--bg-color);
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    margin-bottom: 0px;
    word-break: break-all;
}

.btn-action {
    flex: 1;
}

.copy-btn {
    background: var(--card-border);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.copy-btn:hover {
    background: var(--text-muted);
    color: #fff;
    border-color: var(--text-muted);
}

.copy-btn.copied {
    background: var(--accent-success);
    color: #fff;
    border-color: var(--accent-success);
}

/* Contact Section */
.contact-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Uptime Section */
.uptime-section {
    margin-bottom: 50px;
    animation: fadeIn 0.8s ease-out;
}

.uptime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.status-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.status-card:hover { 
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.status-info { 
    display: flex; 
    align-items: center;
    gap: 10px;
}

.status-dot-wrap { 
    position: relative; 
    width: 10px; 
    height: 10px; 
    flex-shrink: 0; 
}

.status-dot { 
    width: 100%; 
    height: 100%; 
    border-radius: 50%; 
    z-index: 2;
    position: relative;
}

.status-dot.up { 
    background: var(--accent-success); 
    box-shadow: 0 0 6px var(--accent-success); 
}

.status-dot.down { 
    background: var(--accent-danger); 
    box-shadow: 0 0 6px var(--accent-danger); 
}

.status-dot.up::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: var(--accent-success);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
    opacity: 0.4;
    z-index: 1;
}

.status-name { 
    font-size: 1.05rem; 
    font-weight: 600; 
    color: var(--text-main); 
}

.status-label { 
    font-size: 0.75rem; 
    font-weight: 700; 
    padding: 3px 8px; 
    border-radius: 5px; 
    text-transform: uppercase; 
    background: rgba(0,0,0,0.3); 
    border: 1px solid transparent;
}

.status-label.online { 
    color: var(--accent-success); 
    border-color: rgba(46, 160, 67, 0.15);
}

.status-label.offline { 
    color: var(--accent-danger); 
    border-color: rgba(248, 81, 73, 0.15);
}

/* Heartbeat Bar Chart */
.heartbeat-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.heartbeat-bars {
    display: flex;
    gap: 4px;
    height: 28px;
    align-items: flex-end;
    width: 100%;
}

.heartbeat-bar {
    flex: 1;
    height: 20px;
    border-radius: 20px;
    background: var(--card-border);
    transition: all 0.2s;
    min-width: 3px;
}

.heartbeat-bar.up {
    background: var(--accent-success);
    opacity: 0.85;
}

.heartbeat-bar.down {
    background: var(--accent-danger);
}

.heartbeat-bar:hover {
    transform: scaleY(1.3);
    opacity: 1;
}

.heartbeat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.status-pct {
    font-weight: 600;
    color: var(--text-main);
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    70% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.contact-section p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

.email-link {
    color: var(--accent-primary);
    font-size: 1rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.email-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

footer p { margin-bottom: 5px; }

.admin-link {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s;
}

.admin-link:hover {
    color: var(--accent-primary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.toast {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--accent-success);
    color: var(--text-main);
    padding: 12px 20px;
    margin-top: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    animation: fadeInSlide 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none; /* Prevent accidental clicks during toast */
}

.toast.removing {
    animation: fadeOutSlide 0.4s ease-in forwards;
    opacity: 0;
}

.toast.error {
    border-left-color: var(--accent-danger);
}

.toast.removing {
    animation: fadeOutSlide 0.4s ease-in forwards;
}

/* Loader */
.loading-spinner {
    width: 25px;
    height: 25px;
    border: 2px solid var(--card-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

/* Admin Specific */
.admin-card {
    max-width: 600px;
    margin: 30px auto;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

.form-group label small {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 5px;
}

.form-input {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.btn {
    background: var(--accent-success);
    color: #fff;
    border: 1px solid rgba(240, 246, 252, 0.1);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn:hover {
    background: var(--accent-success-hover);
}

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

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

.btn-danger {
    background: transparent;
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
}
.btn-danger:hover {
    background: var(--accent-danger);
    color: #fff;
}

.error-msg {
    color: var(--accent-danger);
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-align: center;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.4);
    padding: 10px;
    border-radius: 6px;
    display: none;
}

.server-edit-item {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.remove-server-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.remove-server-btn:hover {
    color: var(--accent-danger);
}

/* Code Snippet Style for the admin */
.config-group-title {
    font-size: 1.1rem;
    margin-top: 30px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--card-border);
    color: var(--accent-primary);
}

/* Item Reordering Styles */
.item-controls {
    position: absolute;
    top: 15px;
    right: 45px; /* Leave space for the remove button */
    display: flex;
    gap: 8px;
}

.reorder-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.reorder-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.1);
}

.reorder-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInSlide {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOutSlide {
    0% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(20px); }
}

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