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

/* CSS Variables for theming */
:root {
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.25);

    /* Status colors */
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    --color-neutral: #6b7280;

    /* Brand colors */
    --color-brand: #0500FF;
    --color-brand-light: #3b4cff;
    --color-brand-dark: #0400cc;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f1419;
        --bg-secondary: #1a1f2e;
        --bg-card: #242936;
        --text-primary: #ffffff;
        --text-secondary: #94a3b8;
        --border-color: #374151;
        --shadow-light: rgba(0, 0, 0, 0.2);
        --shadow-medium: rgba(0, 0, 0, 0.4);
        --shadow-heavy: rgba(0, 0, 0, 0.6);

        /* Override brand color for dark theme */
        --color-brand: #60a5fa;
        --color-brand-light: #93c5fd;
        --color-brand-dark: #3b82f6;
    }
}

/* Manual theme override classes */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-card: #242936;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: #374151;
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.6);

    /* Override brand color for dark theme */
    --color-brand: #60a5fa;
    --color-brand-light: #93c5fd;
    --color-brand-dark: #3b82f6;
}

*, html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

.red {
    color: var(--color-error);
}

.gray {
    color: var(--color-neutral);
}

.green {
    color: var(--color-success);
}

.wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: background 0.3s ease;
    overflow-x: hidden;
    width: 100vw;
    max-width: 100%;
    box-sizing: border-box;
}

.provider_name {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px -1px var(--shadow-light);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    color: var(--color-brand);
    font-weight: 600;
    letter-spacing: -0.01em;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.provider_name:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--shadow-light), 0 4px 6px -2px var(--shadow-medium);
}

.btn {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: 2px solid #2e6da4;
    box-shadow:
        0 8px 32px -8px rgba(74, 144, 226, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 4px 12px rgba(74, 144, 226, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    position: relative;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    overflow: visible;
    flex-shrink: 0;
}

.btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: -1;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 12px 40px -8px rgba(74, 144, 226, 0.6),
        0 8px 25px -5px rgba(74, 144, 226, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: #5ba0f2;
}

.btn:hover::before {
    opacity: 0;
}

.btn:active {
    transform: translateY(-2px) scale(1.01);
    transition: all 0.1s ease;
}


.btn .progress-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--color-brand) 0%, transparent 25%, var(--color-brand) 50%, transparent 75%, var(--color-brand) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: rotate 1.5s linear infinite;
}

.btn .progress-ring::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--bg-card);
}

.btn.active .progress-ring {
    opacity: 1;
}

.btn .pulse-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-brand) 0%, transparent 70%);
    opacity: 0;
    animation: pulse 2.5s ease-in-out infinite;
}

.btn.ready .pulse-ring {
    opacity: 0.15;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.2;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.info_description {
    transition: opacity 0.5s ease, transform 0.5s ease, margin 0.5s ease, height 0.5s ease;
    height: auto;
    min-height: 48px;
}

.info_description.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    margin: 0;
    height: 0;
    overflow: hidden;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    position: relative;
    z-index: 10;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.reload_img {
    z-index: 10;
    position: relative;
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 4px var(--shadow-light));
    transition: all 0.3s ease;
}

.btn:hover .reload_img {
    transform: rotate(90deg) scale(1.1);
}

.info {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px var(--shadow-light), 0 2px 4px -1px var(--shadow-medium);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    font-weight: 400;
    font-size: 0.875rem;
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--shadow-light), 0 4px 6px -2px var(--shadow-medium);
}

.main_ip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px -1px var(--shadow-light);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    text-align: left;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

.main_ip span:first-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.main_ip span:last-child {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inconsolata', monospace;
}

.main_ip:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--shadow-medium), 0 4px 6px -2px var(--shadow-light);
}

.info p {
    padding: 10px;
}

.info_description {
    color: var(--color-brand);
    font-weight: 500;
    padding: 0.75rem 1rem;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.info_description span:first-child {
    color: var(--text-secondary);
}

.info_description span:last-child {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.url_block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px -1px var(--shadow-light);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.url_block:hover {
    background: var(--bg-card);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px var(--shadow-light), 0 2px 4px -1px var(--shadow-medium);
}

.url_block p {
    text-align: left;
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    align-items: center;
}

.url_block p:nth-child(1) {
    text-transform: uppercase;
    text-align: center;
    display: block;
}

#url, #browsers, #software {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    box-sizing: border-box;
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 0;
}

#url:hover, #browsers:hover, #software:hover {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(5, 0, 255, 0.1);
    transform: translateY(-1px);
}

#url:active, #browsers:active, #software:active {
    transform: translateY(0);
    box-shadow: 0 0 0 3px rgba(5, 0, 255, 0.2);
}

.url_block span {
    padding: 5px 0;
}

.url_block p span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Inter', sans-serif;
}

.time_reload {
    font-weight: 500;
}



.info_text {
    text-align: center;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    width: 450px;
    max-width: 450px;
    height: calc(1.6em * 2 + 2.5rem); /* 2 строки текста + padding */
    min-height: calc(1.6em * 2 + 2.5rem);
    max-height: calc(1.6em * 2 + 2.5rem);
    margin: 0 auto;
    transition: all 0.5s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

.info_text small {
    display: block;
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    opacity: 0.8;
}

.btn.gray {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #9ca3af;
    cursor: not-allowed;
    border: 2px solid #d1d5db;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 4px 12px -4px rgba(0, 0, 0, 0.1);
    opacity: 0.7;
}

/* Dark theme disabled button */
[data-theme="dark"] .btn.gray {
    background: linear-gradient(135deg, #374151, #4b5563);
    color: #9ca3af;
    border: 2px solid #4b5563;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px -4px rgba(75, 85, 99, 0.3);
}

.btn.green {
    background: linear-gradient(145deg, #10b981, #059669);
    color: white;
    border: 3px solid #10b981;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 8px 32px -8px rgba(16, 185, 129, 0.4);
}

/* Light theme adjustments */
[data-theme="light"] .btn.green {
    background: linear-gradient(135deg, #4a90e2, #357abd) !important;
    color: white !important;
    border: 2px solid #2e6da4 !important;
    box-shadow:
        0 8px 32px -8px rgba(74, 144, 226, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 4px 12px rgba(74, 144, 226, 0.2) !important;
}

[data-theme="light"] .btn.green:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 12px 40px -8px rgba(74, 144, 226, 0.6),
        0 8px 25px -5px rgba(74, 144, 226, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    border-color: #5ba0f2 !important;
}

[data-theme="light"] .btn.green.ready {
    animation: readyGlowLight 3s ease-in-out infinite;
}

@keyframes readyGlowLight {
    0%, 100% {
        box-shadow:
            0 8px 32px -8px rgba(5, 0, 255, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 4px 12px rgba(5, 0, 255, 0.1) !important;
    }
    50% {
        box-shadow:
            0 12px 40px -8px rgba(5, 0, 255, 0.25),
            0 8px 25px -5px rgba(5, 0, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    }
}

.btn.green.ready {
    animation: readyGlow 3s ease-in-out infinite;
}

@keyframes readyGlow {
    0%, 100% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            0 8px 32px -8px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            0 12px 40px -8px rgba(59, 130, 246, 0.6);
    }
}

.btn.red {
    background: linear-gradient(145deg, #ef4444, #dc2626);
    color: white;
    border: 3px solid #ef4444;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 8px 32px -8px rgba(239, 68, 68, 0.4);
}

.btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: 2px solid #1d4ed8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 6px 24px -6px rgba(59, 130, 246, 0.4);
}

.reboot-btn-overlay {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    box-shadow:
        0 6px 20px -4px var(--shadow-medium),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 15;
    backdrop-filter: blur(10px);
}

.reboot-btn-overlay:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 25px -5px var(--shadow-heavy),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: var(--color-brand);
}

.reboot-btn-overlay.active {
    background: linear-gradient(145deg, var(--color-brand), var(--color-brand-light));
    color: white;
    border-color: var(--color-brand);
    box-shadow:
        0 6px 20px -4px rgba(96, 165, 250, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.reboot-btn-overlay.active:hover {
    background: linear-gradient(145deg, var(--color-brand-light), var(--color-brand));
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 25px -5px rgba(96, 165, 250, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.reboot-btn-overlay.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-secondary);
    color: var(--color-neutral);
}

.reboot-btn-overlay.disabled:hover {
    transform: none;
    box-shadow: 0 4px 6px -1px var(--shadow-light), 0 2px 4px -1px var(--shadow-medium);
    border-color: var(--border-color);
}

.reboot-icon {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: transform 0.3s ease;
}

.reboot-btn-overlay:hover .reboot-icon {
    transform: rotate(180deg);
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 25px -5px var(--shadow-medium), 0 10px 10px -5px var(--shadow-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-error);
}

.toast.info {
    border-left: 4px solid var(--color-info);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 2rem;
    left: 2rem;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px -1px var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--shadow-light), 0 4px 6px -2px var(--shadow-medium);
    border-color: var(--color-brand);
}

.theme-toggle:hover .theme-icon {
    color: var(--color-brand);
    transform: rotate(180deg);
}

.theme-icon {
    width: 18px;
    height: 18px;
    color: #6b7280;
    stroke-width: 2;
    transition: all 0.3s ease;
    stroke: currentColor;
    fill: none;
    opacity: 0.9;
}

.theme-toggle:hover .theme-icon {
    color: var(--color-brand);
    transform: rotate(180deg);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

@media screen and (max-width: 768px) {
    .wrap {
        padding: 1rem;
        gap: 1.5rem;
    }

    .btn {
        width: 200px;
        height: 200px;
    }

    .provider_name {
        font-size: 1.25rem;
        padding: 0.75rem 1.5rem;
    }

    .info {
        padding: 1.25rem;
        margin: 0 0.5rem;
    }

    .url_block {
        padding: 1rem;
    }

    .url_block p {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .url_block p span:first-child {
        text-align: left;
    }

    .reboot-btn-overlay {
        width: 44px;
        height: 44px;
        top: -14px;
        right: -14px;
    }

    .reboot-icon {
        width: 18px;
        height: 18px;
    }

    .theme-toggle {
        top: 1rem;
        left: 1rem;
        width: 40px;
        height: 40px;
    }

    .toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
        transform: translateY(-100%);
    }

    .toast.show {
        transform: translateY(0);
    }

    .info_text {
        width: 100%;
        max-width: calc(100vw - 2rem);
        margin: 0 1rem;
        padding: 1rem 1.25rem;
        height: calc(1.5em * 3 + 2rem); /* 3 строки текста + padding для мобильной */
        min-height: calc(1.5em * 3 + 2rem);
        max-height: calc(1.5em * 3 + 2rem);
        font-size: 0.8125rem;
        line-height: 1.5;
    }

    .info_text small {
        font-size: 0.6875rem;
        margin-top: 0.375rem;
        line-height: 1.4;
    }

    .info_description {
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
        padding: 0.875rem 1rem;
        font-size: 0.8125rem;
    }

    .info_description span:first-child {
        font-size: 0.8125rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .info_description span:last-child {
        font-size: 0.875rem;
        text-align: right;
        flex: 1;
        min-width: 0;
    }
}

