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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: white;
    margin: 0;
}

.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: flex-end;
    margin: 0;
    gap: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-outline {
    background: transparent;
    color: #4f46e5;
    border: 1px solid #4f46e5;
}

.btn-outline:hover {
    background: #4f46e5;
    color: white;
}

.proxy-container {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.proxy-list {
    display: grid;
    gap: 1rem;
}

.status-bar {
    background: #f8fafc;
    padding: 0.75rem 2rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.proxy-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.proxy-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
}

.stats-inline {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.stat-item {
    color: #6b7280;
    font-size: 0.9rem;
    white-space: nowrap;
}

.stat-item strong {
    color: #1f2937;
    font-size: 1rem;
}

.batch-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.selected-info {
    color: #6b7280;
    font-size: 0.9rem;
    margin-left: auto;
}

.proxy-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: white;
    transition: all 0.2s ease;
}

.proxy-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.proxy-checkbox {
    flex-shrink: 0;
}

.proxy-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.proxy-name {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.proxy-endpoints {
    display: flex;
    gap: 1rem;
    color: #6b7280;
    font-size: 0.85rem;
    flex: 1;
}

.endpoint {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proxy-endpoints-compact {
    color: #6b7280;
    font-size: 0.85rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.proxy-status-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    min-width: 100px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-running .status-dot {
    background-color: #10b981;
}

.status-stopped .status-dot {
    background-color: #ef4444;
}

.proxy-actions-inline {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.proxy-actions-inline .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

@media (max-width: 1200px) {
    .header-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 1rem;
    }
    
    .stats-inline {
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .proxy-endpoints {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .proxy-endpoints-compact {
        font-size: 0.8rem;
    }
    
    .proxy-name {
        max-width: 120px;
    }
    
    .header-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.75rem;
    }
    
    .stats-inline {
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .proxy-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-right {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .proxy-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .proxy-info {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .proxy-endpoints {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .proxy-endpoints-compact {
        font-size: 0.75rem;
        overflow: visible;
        white-space: normal;
        word-break: break-all;
    }
    
    .proxy-actions-inline {
        justify-content: stretch;
    }
    
    .proxy-actions-inline .btn {
        flex: 1;
    }
}

.loader {
    width: 35px;
    height: 30px;
    background: linear-gradient(#0000 calc(1*100%/6),#fff 0 calc(3*100%/6),#0000 0),
              linear-gradient(#0000 calc(2*100%/6),#fff 0 calc(4*100%/6),#0000 0),
              linear-gradient(#0000 calc(3*100%/6),#fff 0 calc(5*100%/6),#0000 0);
    background-size: 10px 400%;
    background-repeat: no-repeat;
    animation: matrix 1s infinite linear;
    flex-shrink: 0;
    margin-right: 15px;
}

@keyframes matrix {
    0% {
        background-position: 0% 100%, 50% 100%, 100% 100%
    }
    100% {
        background-position: 0% 0%, 50% 0%, 100% 0%
    }
}



.subtitle {
    font-size: 0.7em;
    color: #b5bcc9;
    font-weight: 400;
    margin-left: 10px;
}

.author-info {
    text-align: right;
    color: #6b7280;
    font-size: 0.85rem;
}

.social-link {
    color: #3b82f6;
    text-decoration: none;
    margin-left: 0.5rem;
    transition: color 0.2s ease;
}

.social-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.stats-donate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 2rem;
}

.Btn {
    width: 130px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgb(15, 15, 15);
    border: none;
    color: white;
    font-weight: 600;
    gap: 8px;
    cursor: pointer;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.103);
    position: relative;
    overflow: hidden;
    transition-duration: .3s;
    text-decoration: none;
    border-radius: 4px;
}

.donate-btn-small {
    width: 100px;
    height: 32px;
    font-size: 0.85rem;
    gap: 6px;
}

.svgIcon {
    width: 16px;
}

.donate-btn-small .svgIcon {
    width: 12px;
}

.svgIcon path {
    fill: white;
}

.Btn::before {
    width: calc(100% + 40px);
    aspect-ratio: 1/1;
    position: absolute;
    content: "";
    background-color: white;
    border-radius: 50%;
    left: -20px;
    top: 50%;
    transform: translate(-150%, -50%);
    transition-duration: .5s;
    mix-blend-mode: difference;
}

.Btn:hover::before {
    transform: translate(0, -50%);
}

.Btn:active {
    transform: translateY(4px);
    transition-duration: .3s;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

.btn-delete {
    background-color: #6b7280;
    color: white;
    border: none;
}

.btn-delete:hover {
    background-color: #4b5563;
}

.header-actions .btn-outline {
    background-color: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.header-actions .btn-outline:hover {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.modal-compact {
    max-width: 750px;
    width: 85vw;
    max-height: 85vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    pointer-events: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    color: white;
}

.header-switch {
    display: flex;
    align-items: center;
    margin: 0;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

.switch-input {
    display: none;
}

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch-input:checked + .switch-slider {
    background: #6366f1;
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.modal-header .close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-header .close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.proxy-form-compact {
    padding: 1rem 1.5rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select {
    padding: 0.625rem 0.75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-group input::placeholder {
    color: #9ca3af;
    font-size: 0.8125rem;
}

.name-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.name-input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
}

.name-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.name-input::placeholder {
    color: #9ca3af;
    font-size: 0.8125rem;
}

.form-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-section h4 {
    margin: 0 0 0.625rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.form-group-sm {
    flex: 0 0 107px;
}

.form-group-md {
    flex: 0 0 110px;
}

.form-group-auth {
    flex: 0 0 100px !important;
    max-width: 100px !important;
}

.form-group-lg {
    flex: 1;
    max-width: 200px;
}

.form-group-spacer {
    flex: 0 0 80px;
    visibility: hidden;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.25rem;
}

.form-actions .btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    min-width: 90px;
}

.form-actions .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.form-actions .btn-primary:hover {
    background: linear-gradient(135deg, #5856eb 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.form-actions .btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.form-actions .btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

@media (max-width: 900px) {
    .modal-compact {
        width: 90vw;
        max-width: none;
    }
    
    .form-row {
        flex-wrap: wrap;
    }
    
    .form-group-lg {
        flex: 1 1 200px;
    }
    
    .form-group-md {
        flex: 1 1 120px;
    }
    
    .form-group-auth {
        flex: 0 0 100px !important;
        max-width: 100px !important;
    }
}

@media (max-width: 640px) {
    .modal-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .header-switch {
        margin: 0;
    }
    
    .modal-header .close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        padding: 0.25rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-group-sm,
    .form-group-md,
    .form-group-auth,
    .form-group-lg {
        flex: none;
    }
    
    .form-group-spacer {
        display: none;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}