/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Apple System Colors */
    --system-blue: #007AFF;
    --system-green: #34C759;
    --system-red: #FF3B30;
    --system-orange: #FF9500;
    --system-yellow: #FFCC00;
    --system-purple: #AF52DE;
    --system-pink: #FF2D92;
    --system-indigo: #5856D6;
    --system-teal: #5AC8FA;
    
    /* Gray Colors */
    --system-gray: #8E8E93;
    --system-gray2: #AEAEB2;
    --system-gray3: #C7C7CC;
    --system-gray4: #D1D1D6;
    --system-gray5: #E5E5EA;
    --system-gray6: #F2F2F7;
    
    /* Label Colors */
    --label-primary: #000000;
    --label-secondary: rgba(60, 60, 67, 0.6);
    --label-tertiary: rgba(60, 60, 67, 0.3);
    --label-quaternary: rgba(60, 60, 67, 0.18);
    
    /* Background Colors */
    --background-primary: #FFFFFF;
    --background-secondary: #F2F2F7;
    --background-tertiary: #FFFFFF;
    
    /* Fill Colors */
    --fill-primary: rgba(120, 120, 128, 0.2);
    --fill-secondary: rgba(120, 120, 128, 0.16);
    --fill-tertiary: rgba(120, 120, 128, 0.12);
    --fill-quaternary: rgba(120, 120, 128, 0.08);
    
    /* Separator Colors */
    --separator-opaque: #C6C6C8;
    --separator-non-opaque: rgba(60, 60, 67, 0.36);
    
    /* Apple Typography */
    --font-large-title: -apple-system-headline1, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-title1: -apple-system-headline, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-title2: -apple-system-subheadline, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-title3: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-caption: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Colors */
        --label-primary: #FFFFFF;
        --label-secondary: rgba(235, 235, 245, 0.6);
        --label-tertiary: rgba(235, 235, 245, 0.3);
        --label-quaternary: rgba(235, 235, 245, 0.18);
        
        --background-primary: #000000;
        --background-secondary: #1C1C1E;
        --background-tertiary: #2C2C2E;
        
        --fill-primary: rgba(120, 120, 128, 0.36);
        --fill-secondary: rgba(120, 120, 128, 0.32);
        --fill-tertiary: rgba(120, 120, 128, 0.24);
        --fill-quaternary: rgba(120, 120, 128, 0.18);
        
        --separator-opaque: #38383A;
        --separator-non-opaque: rgba(84, 84, 88, 0.65);
        
        --system-gray6: #1C1C1E;
    }
}

body {
    font-family: var(--font-body);
    background: var(--background-secondary);
    min-height: 100vh;
    color: var(--label-primary);
    line-height: 1.47059;
    font-size: 17px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Заголовок */
.header {
    background: var(--background-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl) var(--spacing-xl);
    text-align: center;
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--separator-non-opaque);
}

.header h1 {
    font-family: var(--font-large-title);
    font-size: 34px;
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.41px;
}

.header p {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    color: var(--label-secondary);
    line-height: 1.47059;
}

/* Вкладки */
.tabs {
    display: flex;
    background: var(--background-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xs);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--separator-non-opaque);
}

.tab-button {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 590;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: var(--label-secondary);
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button.active {
    background: var(--system-blue);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 122, 255, 0.3);
}

.tab-button:hover:not(.active) {
    background: var(--fill-quaternary);
    color: var(--label-primary);
}

.tab-button:active {
    transform: scale(0.98);
}

/* Контент вкладок */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Секции */
.section {
    background: var(--background-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--separator-non-opaque);
}

.section h2 {
    font-family: var(--font-title1);
    font-size: 28px;
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    letter-spacing: -0.36px;
}

/* Группы форм */
.form-group {
    margin-bottom: var(--spacing-xxl);
}

.form-group h3 {
    font-family: var(--font-title2);
    font-size: 22px;
    font-weight: 600;
    color: var(--label-primary);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--separator-non-opaque);
    letter-spacing: -0.26px;
}

/* Группы ввода */
.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-group label {
    display: block;
    font-family: var(--font-body);
    font-weight: 590;
    color: var(--label-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 17px;
    line-height: 1.47059;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-md);
    border: 1px solid var(--separator-non-opaque);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.47059;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: var(--background-primary);
    color: var(--label-primary);
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--system-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-group input::placeholder {
    color: var(--label-tertiary);
}

.input-group select {
    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='%23999' 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 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Кнопки */
.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 590;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 44px;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--system-blue);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: #0056CC;
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.4);
}

.btn-secondary {
    background: var(--system-teal);
    color: white;
    box-shadow: 0 1px 3px rgba(90, 200, 250, 0.3);
}

.btn-secondary:hover {
    background: #32ADE6;
    box-shadow: 0 2px 6px rgba(90, 200, 250, 0.4);
}

.btn-danger {
    background: var(--system-red);
    color: white;
    box-shadow: 0 1px 3px rgba(255, 59, 48, 0.3);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 15px;
    min-height: 36px;
}

.btn-danger:hover {
    background: #D70015;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
}

/* Списки */
.links-list,
.numbers-list {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.link-item,
.number-item {
    background: var(--background-primary);
    border: 1px solid var(--separator-non-opaque);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.link-item:hover,
.number-item:hover {
    background: var(--fill-quaternary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.item-info {
    flex: 1;
}

.item-country {
    font-family: var(--font-body);
    font-weight: 590;
    color: var(--label-primary);
    font-size: 17px;
    margin-bottom: var(--spacing-xs);
    line-height: 1.47059;
}

.item-details {
    color: var(--label-secondary);
    font-size: 15px;
    line-height: 1.33337;
}

.item-url {
    color: var(--system-blue);
    text-decoration: none;
    word-break: break-all;
}

.item-url:hover {
    text-decoration: underline;
}

/* Результат API */
.api-result {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.33337;
    white-space: pre-wrap;
    display: none;
    border: 1px solid var(--separator-non-opaque);
}

.api-result.success {
    background: rgba(52, 199, 89, 0.1);
    border-color: var(--system-green);
    color: var(--system-green);
}

.api-result.error {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--system-red);
    color: var(--system-red);
}

/* Уведомления */
.notification {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-weight: 590;
    font-size: 17px;
    line-height: 1.47059;
    box-shadow: var(--shadow-xl);
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    max-width: 350px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

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

.notification.success {
    background: rgba(52, 199, 89, 0.9);
    border: 1px solid var(--system-green);
    color: white;
}

.notification.error {
    background: rgba(255, 59, 48, 0.9);
    border: 1px solid var(--system-red);
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        margin-bottom: 5px;
    }
    
    .section {
        padding: 20px;
    }
    
    .link-item,
    .number-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .notification {
        right: 15px;
        left: 15px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Статистика */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--system-blue);
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.stat-card:nth-child(2) {
    background: var(--system-green);
    border-color: rgba(52, 199, 89, 0.2);
}

.stat-card:nth-child(3) {
    background: var(--system-orange);
    border-color: rgba(255, 149, 0, 0.2);
}

.stat-card:nth-child(4) {
    background: var(--system-purple);
    border-color: rgba(175, 82, 222, 0.2);
}

.stat-number {
    font-family: var(--font-title1);
    font-size: 34px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.41px;
}

.stat-label {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 590;
    opacity: 0.9;
    line-height: 1.33337;
}

/* Фильтры */
.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--system-blue);
    color: var(--system-blue);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 590;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline:hover {
    background: var(--system-blue);
    color: white;
}

.btn-outline:active {
    transform: scale(0.98);
}

/* История */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--separator-non-opaque);
    margin-bottom: var(--spacing-lg);
    -webkit-overflow-scrolling: touch;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.33337;
}

.history-table th {
    background: var(--background-secondary);
    padding: var(--spacing-md);
    text-align: left;
    font-family: var(--font-body);
    font-weight: 590;
    color: var(--label-primary);
    border-bottom: 1px solid var(--separator-non-opaque);
    white-space: nowrap;
    font-size: 15px;
}

.history-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--separator-non-opaque);
    vertical-align: top;
    background: var(--background-primary);
}

.history-table tbody tr:hover {
    background: var(--fill-quaternary);
}

.response-type {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 590;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.response-type.otp {
    background: rgba(255, 204, 0, 0.2);
    color: var(--system-orange);
    border: 1px solid rgba(255, 149, 0, 0.3);
}

.response-type.redirect {
    background: rgba(90, 200, 250, 0.2);
    color: var(--system-teal);
    border: 1px solid rgba(90, 200, 250, 0.3);
}

.response-type.block {
    background: rgba(255, 59, 48, 0.2);
    color: var(--system-red);
    border: 1px solid rgba(255, 59, 48, 0.3);
}

.response-url {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.response-url a {
    color: #667eea;
    text-decoration: none;
}

.response-url a:hover {
    text-decoration: underline;
}

.user-agent {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.pagination button {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--separator-non-opaque);
    background: var(--background-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 590;
    color: var(--label-primary);
    min-height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover:not(:disabled) {
    background: var(--fill-quaternary);
    border-color: var(--system-blue);
}

.pagination button.active {
    background: var(--system-blue);
    color: white;
    border-color: var(--system-blue);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination button:active:not(:disabled) {
    transform: scale(0.95);
}

.pagination-info {
    font-size: 15px;
    color: var(--label-secondary);
    margin: 0 var(--spacing-md);
    line-height: 1.33337;
}

/* Аутентификация */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: var(--background-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--separator-non-opaque);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    font-family: var(--font-title2);
    font-size: 22px;
    font-weight: 600;
    color: var(--label-primary);
    margin-bottom: var(--spacing-xl);
    letter-spacing: -0.26px;
}

.auth-error {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid var(--system-red);
    border-radius: var(--radius-md);
    color: var(--system-red);
    font-size: 15px;
    display: none;
}

.auth-error.show {
    display: block;
}

/* Скрытие контента */
.hidden {
    display: none !important;
}

/* Панель управления */
.admin-panel {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--spacing-lg);
}

.logout-btn {
    font-size: 15px;
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: 36px;
}

/* Анимации */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
