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

:root {
    --primary: #000;
    --secondary: #86868b;
    --background: #fbfbfd;
    --surface: #ffffff;
    --border: #d2d2d7;
    --error: #ff3b30;
    --success: #34c759;
    --blue: #007aff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--surface);
    padding: 60px 40px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.logo {
    font-size: 48px;
    margin-bottom: 12px;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--secondary);
    font-size: 17px;
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px 16px;
    font-size: 17px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    transition: all 0.2s ease;
    font-family: inherit;
}

input:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--surface);
}

.btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 17px;
    font-weight: 500;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
}

.btn:hover {
    transform: scale(0.98);
    opacity: 0.9;
}

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: 12px;
    display: none;
}

/* Dashboard */
.dashboard {
    display: none;
    min-height: 100vh;
}

.nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-small {
    padding: 6px 14px;
    font-size: 14px;
    background: var(--background);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-small:hover {
    background: var(--border);
}

.user-badge {
    padding: 4px 10px;
    font-size: 12px;
    background: var(--blue);
    color: white;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.tabs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 32px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 0;
    font-size: 17px;
    color: var(--secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.section-description {
    color: var(--secondary);
    margin-bottom: 24px;
}

.config-grid {
    display: grid;
    gap: 20px;
}

.config-item {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

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

.config-label {
    font-weight: 500;
}

.config-input {
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    transition: all 0.2s ease;
}

.config-input:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--surface);
}

.save-btn {
    background: var(--blue);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
}

.save-btn:hover {
    background: #0051d5;
}

.delete-btn {
    background: var(--error);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: #d70015;
}

.action-btn {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--error);
    color: white;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--background);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 14px;
    color: var(--secondary);
    margin-top: 4px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

.client-grid, .proxy-grid {
    display: grid;
    gap: 16px;
}

.client-card, .proxy-card {
    background: var(--background);
    padding: 20px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
}

.client-info, .proxy-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.client-name, .proxy-name {
    font-weight: 600;
    font-size: 16px;
}

.client-details, .proxy-details {
    font-size: 14px;
    color: var(--secondary);
}

.status-badge {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}

.status-badge.active, .status-badge.used {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(255, 59, 48, 0.1);
    color: var(--error);
}

.status-badge.unused {
    background: rgba(255, 159, 10, 0.1);
    color: #ff9f0a;
}

/* Table styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: var(--background);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--secondary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--background);
}

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

/* Icon-only button styles */
.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background: var(--background);
    border-color: var(--blue);
}

.btn-icon-only.delete:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.btn-icon-only svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.table-stats-line {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--secondary);
}

.table-stats-line strong {
    color: var(--primary);
    font-weight: 600;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

/* Hide columns on mobile */
@media (max-width: 768px) {
    .config-item {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }
    
    .tab {
        font-size: 14px;
        padding: 8px 4px;
        white-space: nowrap;
        min-width: fit-content;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .nav-content {
        padding: 0 16px;
    }
    
    .content {
        padding: 20px 16px;
    }
    
    .section {
        padding: 20px;
    }
    
    /* Table responsive styles */
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
    
    /* Hide specific columns on mobile */
    .mobile-hide {
        display: none;
    }
    
    /* Make action buttons more compact on mobile */
    .action-btn {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    /* Stack table stats on mobile */
    .table-stats-line {
        flex-wrap: wrap;
        font-size: 13px;
    }
}