:root {
    --tg-bg: #0e1621;
    --tg-surface: #17212b;
    --tg-surface-hover: #202b36;
    --tg-text: #f5f5f5;
    --tg-muted: #7a8a96;
    --tg-primary: #5288c1;
    --tg-primary-hover: #4b7db3;
    --tg-border: #101921;
    --tg-online: #5dc452;
    --tg-offline: #e15e5c;
    --tg-unknown: #e5b05c;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--tg-bg);
    color: var(--tg-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    background-color: var(--tg-surface);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--tg-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content h1 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--tg-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-content h1::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--tg-primary);
    border-radius: 50%;
}

.header-content h1 span {
    color: var(--tg-muted);
    font-weight: 400;
}

.header-content p {
    font-size: 0.85rem;
    color: var(--tg-muted);
    margin-top: 0.2rem;
}

.btn-outline {
    background: transparent;
    color: var(--tg-primary);
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    text-transform: uppercase;
}

.btn-outline:hover {
    background: rgba(82, 136, 193, 0.1);
}

.btn-primary {
    background-color: var(--tg-primary);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

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

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

input {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--tg-bg);
    border: 1px solid var(--tg-border);
    border-radius: 6px;
    color: var(--tg-text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--tg-primary);
}

input::placeholder {
    color: var(--tg-muted);
}

.add-proxy-section {
    background-color: var(--tg-surface);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--tg-border);
}

.add-proxy-section h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--tg-primary);
}

#addProxyForm {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.proxy-list-section {
    padding: 1.5rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.list-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--tg-primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--tg-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--tg-text);
}

.proxy-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.proxy-card {
    background-color: var(--tg-surface);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: background-color 0.2s;
}

.proxy-card:hover {
    background-color: var(--tg-surface-hover);
}

.proxy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online { color: var(--tg-online); }
.status-online::before { background-color: var(--tg-online); }

.status-offline { color: var(--tg-offline); }
.status-offline::before { background-color: var(--tg-offline); }

.status-unknown { color: var(--tg-unknown); }
.status-unknown::before { background-color: var(--tg-unknown); }

.delete-btn { color: var(--tg-muted); }
.delete-btn:hover {
    color: var(--tg-offline);
    background: rgba(225, 94, 92, 0.1);
}

.proxy-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.proxy-details p {
    font-size: 0.95rem;
    color: var(--tg-text);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding-bottom: 0.4rem;
}

.proxy-details p:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.proxy-details strong {
    color: var(--tg-muted);
    font-weight: 400;
}

.copy-link {
    display: inline-block;
    color: var(--tg-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    align-self: flex-start;
}

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

.ping-good { color: var(--tg-online); font-weight: 500; }
.ping-med  { color: var(--tg-unknown); font-weight: 500; }
.ping-bad  { color: var(--tg-offline); font-weight: 500; }

.hidden { display: none !important; }

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--tg-surface);
    width: 90%;
    max-width: 350px;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.modal-content h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--tg-text);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#toastContainer {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.toast {
    background: rgba(23, 33, 43, 0.95);
    color: var(--tg-text);
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: slideUp 0.3s forwards;
    text-align: center;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@media (max-width: 640px) {
    #addProxyForm {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-primary {
        width: 100%;
    }
}
