:root {
    --bg-dark: #0f172a;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-light: #f8fafc;
    --text-muted: #cbd5e1;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-dark) url('grafos.png') center center / cover no-repeat fixed;
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Top Header Panel */
.glass-panel {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.2rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0;
    background: linear-gradient(to right, #a855f7, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* Form Styles */
#connection-form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    justify-content: flex-end;
}

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

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-light);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.line-connector {
    width: 20px;
    height: 2px;
    background: var(--text-muted);
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    white-space: nowrap;
    transition: background 0.3s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

button:hover {
    background: var(--primary-hover);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background: #475569;
    cursor: not-allowed;
}

/* Loading Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.loading .spinner {
    display: inline-block;
}

/* Error Message */
#error-message {
    margin-top: 1rem;
    color: #ef4444;
    font-size: 0.9rem;
    background: rgba(239, 68, 68, 0.1);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.hidden {
    display: none !important;
}

/* Vis-Network Container */
#mynetwork {
    width: 100%;
    flex: 1;
    height: 100%; /* Required for vis-network canvas to calculate correctly */
    min-height: 0;
    position: relative;
    z-index: 1;
}

#mynetwork.has-graph {
    background-color: var(--bg-dark);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .glass-panel {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }

    #connection-form {
        flex-direction: column;
        width: 100%;
    }

    .input-group {
        width: 100%;
        flex-direction: column;
    }

    .input-group input {
        width: 100%;
    }

    .line-connector {
        width: 2px;
        height: 15px;
    }

    button {
        width: 100%;
    }
}

/* Info Button */
.info-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    width: auto;
}
.info-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

/* Info Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
    width: auto;
    padding: 0;
}

.modal-close:hover {
    color: white;
    background: transparent;
    transform: none;
}

.modal-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
}

.modal-header-info h2 {
    font-size: 1.4rem;
    color: white;
    font-weight: 800;
}

.modal-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.accordion-item {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

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

.accordion-header {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 15px 0;
    color: var(--text-light);
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.accordion-header:hover {
    background: transparent;
    color: var(--primary);
    transform: none;
}

.accordion-header .chevron {
    margin-left: auto;
    transition: transform 0.3s;
    opacity: 0.7;
}

.accordion-header.active .chevron {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.accordion-content > div {
    padding-bottom: 20px;
    padding-left: 32px;
}

.modal-list {
    list-style: none;
    padding: 0;
}

.modal-list li {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.modal-list li svg {
    flex-shrink: 0;
    margin-top: 3px;
}

.benefit-box {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
    border-left: 3px solid var(--primary);
}
