* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    margin-bottom: 10px;
    font-size: 2.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.content {
    padding: 30px;
}

.url-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.url-form h2 {
    margin-bottom: 15px;
    color: #555;
}

.url-form form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.url-form input {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    background: #6e8efb;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.btn:hover {
    background: #5a7df9;
}

.admin-btn {
    background: #a777e3;
}

.admin-btn:hover {
    background: #9566d3;
}

.logout-btn {
    background: #e74c3c;
}

.logout-btn:hover {
    background: #d62c1a;
}

.actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.auth-links {
    text-align: center;
}

.auth-links h2 {
    margin-bottom: 15px;
}

.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.links-list, .admin-section {
    margin: 30px 0;
}

.links-list h2, .admin-section h2 {
    margin-bottom: 15px;
    color: #555;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f9f9f9;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.original-url {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
}

.success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #2e7d32;
}

.stats {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-card {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 1.8rem;
    color: #6e8efb;
    margin-bottom: 8px;
    font-weight: 700;
}

/* Copy button styles */
.copy-btn {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: #3e8e41;
}

.copy-btn.copied {
    background: #2196F3;
}

.copy-btn.copied::after {
    content: "✓ Copied!";
}

.copy-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-toast.show {
    opacity: 1;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.delete-btn {
    padding: 6px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: #c0392b;
}

.user-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-form .form-group {
    margin-bottom: 15px;
}

.user-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.user-form input, .user-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 500px;
    max-width: 90%;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

.edit-password-btn, .edit-user-btn {
    padding: 6px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.edit-password-btn:hover, .edit-user-btn:hover {
    background: #0b7dda;
}

.bulk-actions {
    margin: 15px 0;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
}

.select-all {
    margin-right: 10px;
    transform: scale(1.2);
}

.checkbox-cell {
    width: 30px;
    text-align: center;
}

.user-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Table row hover effect */
table tbody tr {
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Checkbox styling */
input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
}

/* Form focus styles */
input:focus, select:focus {
    outline: none;
    border-color: #6e8efb;
    box-shadow: 0 0 0 3px rgba(110, 142, 251, 0.1);
}

/* QR Code styles */
.qr-code {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    text-align: center;
}

.qr-code img {
    max-width: 150px;
    height: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    .content {
        padding: 20px;
    }
    
    .url-form form {
        flex-direction: column;
    }
    
    .actions, .buttons {
        flex-direction: column;
    }
    
    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .user-details {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 20px;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    table th, table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .content {
        padding: 15px;
    }
    
    .user-form {
        padding: 15px;
    }
    
    .stats-grid {
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 1.6rem;
    }
}

/* Animation for modal appearance */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content {
    animation: modalFadeIn 0.3s ease-out;
}

/* Loading state for buttons */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Selection styles for table rows */
.link-checkbox:checked + td {
    background-color: #e3f2fd;
}

/* Zebra striping for tables */
table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

table tbody tr:nth-child(even):hover {
    background-color: #f0f4f8;
}

/* Scrollbar styling for tables */
table::-webkit-scrollbar {
    height: 8px;
}

table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

table::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

table::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus styles for accessibility */
button:focus, input:focus, select:focus {
    outline: 2px solid #6e8efb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    table th {
        border-bottom: 2px solid #000;
    }
    
    .modal-content {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stat-card, .modal-content {
        transition: none;
    }
    
    .btn.loading::after {
        animation: none;
    }
}