/* Modern UI Styles - Completely Rewritten */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --light: #f7fafc;
    --dark: #2d3748;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    padding: 16px 20px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--success);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }

.toast-content {
    flex: 1;
    margin-right: 12px;
    font-weight: 500;
}

.toast-icon {
    font-size: 18px;
    margin-right: 12px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.container-wide {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--gray-900);
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

p {
    color: var(--gray-600);
    margin-bottom: 16px;
}

small {
    font-size: 0.875rem;
    color: var(--gray-500);
    display: block;
    margin-top: 4px;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: inherit;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--gray-300);
}

.form-group input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
    min-width: 120px;
    letter-spacing: 0.025em;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-info {
    background: var(--info);
}

.btn-info:hover {
    background: #3182ce;
}

.btn-secondary {
    background: var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-700);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-large {
    padding: 18px 36px;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 160px;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    padding: 24px;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--success);
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.info-box h3 {
    color: var(--success);
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.info-box p {
    margin-bottom: 8px;
}

.info-box strong {
    color: var(--gray-800);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    table-layout: fixed;
    white-space: nowrap;
}

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    min-width: 120px;
}

/* Fix cho cột thao tác */
td:last-child {
    min-width: 200px;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.action-buttons .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-width: auto;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: var(--radius-md);
}

/* Column widths */
table th:first-child, table td:first-child { width: 15%; } /* Short URL */
table th:nth-child(2), table td:nth-child(2) { width: 10%; } /* RDP Port */
table th:nth-child(3), table td:nth-child(3) { width: 15%; } /* Password */
table th:nth-child(4), table td:nth-child(4) { width: 25%; } /* IPv6 */
table th:nth-child(5), table td:nth-child(5) { width: 12%; } /* Downloads */
table th:last-child, table td:last-child { width: 23%; } /* Actions */

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover {
    background: var(--gray-50);
}

tr:last-child td {
    border-bottom: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 32px 0;
    flex-wrap: wrap;
}

.pagination .btn {
    min-width: 44px;
    padding: 10px 16px;
    font-size: 0.875rem;
}

.pagination .btn.active {
    background: var(--primary);
    color: white;
}

/* Header Actions */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-actions h1 {
    margin: 0;
    flex: 1;
}

.header-actions .btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Search Form */
.search-form {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: stretch;
}

.search-form input {
    flex: 1;
    margin: 0;
    height: auto;
    border-radius: 50px;
    padding: 16px 24px;
    border: 2px solid var(--gray-200);
    font-size: 1rem;
}

.search-form .btn {
    flex-shrink: 0;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    min-width: 140px;
    height: auto;
    border-radius: 50px;
}

/* Result Container */
.result-container {
    margin-top: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.result-container.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .container,
    .container-wide {
        padding: 20px;
        border-radius: var(--radius-md);
        max-width: 100%;
        margin: 0 auto;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .form-group input {
        padding: 14px 16px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions h1 {
        text-align: center;
        margin-bottom: 16px;
    }
    
    .header-actions .btn-group {
        justify-content: center;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form input,
        .search-form .btn {
        width: 100%;
    }
    
        table {
        font-size: 0.875rem;
        white-space: normal;
    }

    th, td {
        padding: 12px 16px;
        min-width: auto;
        word-break: break-word;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }

    .action-buttons .btn {
        width: 100%;
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .search-form input {
        border-radius: var(--radius-lg);
        padding: 14px 20px;
    }

    .search-form .btn {
        border-radius: var(--radius-lg);
    }
    
    .pagination {
        gap: 4px;
    }
    
    .pagination .btn {
        min-width: 36px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .toast {
        margin: 8px;
        max-width: calc(100vw - 32px);
    }
}

@media (max-width: 480px) {
    .container-wide {
        padding: 16px;
        max-width: 100%;
    }
    
    .btn-group {
        grid-template-columns: 1fr;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    th, td {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .search-form .btn {
        padding: 14px 24px;
        min-width: 120px;
        font-size: 0.95rem;
        border-radius: var(--radius-lg);
    }

    .search-form input {
        border-radius: var(--radius-lg);
        padding: 14px 20px;
    }
}
