/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* Login Page Styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h2 {
    margin-bottom: 5px;
    color: #333;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: #fee;
    color: #c53030;
    border: 1px solid #fed7d7;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Dashboard Layout */
.dashboard {
    background: #f8f9fa;
    min-height: 100vh;
}

.dashboard-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.logo i {
    color: #667eea;
    font-size: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    background: #f3f4f6;
    transition: background-color 0.2s;
}

.notification-bell:hover {
    background: #e5e7eb;
}

.notification-bell i {
    font-size: 18px;
    color: #6b7280;
}

.notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.notification-count.hidden {
    display: none;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: 64px;
    right: 20px;
    width: 350px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-height: 500px;
    overflow: hidden;
}

.notification-panel.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.notification-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-notifications {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    border-radius: 4px;
}

.close-notifications:hover {
    background: #f3f4f6;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background: #f9fafb;
}

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

.notification-item.new {
    background: #f0f9ff;
    border-left: 3px solid #0ea5e9;
}

.notification-icon {
    width: 32px;
    height: 32px;
    background: #e0f2fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    font-size: 14px;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-time {
    font-size: 12px;
    color: #6b7280;
}

.notification-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e5e7eb;
    padding: 20px 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.nav-item:hover {
    background: #f9fafb;
    color: #374151;
}

.nav-item.active {
    background: #f0f9ff;
    color: #0284c7;
    border-right-color: #0284c7;
}

.nav-item i {
    width: 20px;
    font-size: 16px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.content-section {
    display: none;
}

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

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

.section-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.section-header p {
    color: #6b7280;
    margin-top: 4px;
}

.last-updated {
    font-size: 14px;
    color: #6b7280;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.stat-card:nth-child(1) .stat-icon { background: #667eea; }
.stat-card:nth-child(2) .stat-icon { background: #f093fb; }
.stat-card:nth-child(3) .stat-icon { background: #4facfe; }
.stat-card:nth-child(4) .stat-icon { background: #43e97b; }

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
}

/* Activity Section */
.activity-section {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.activity-section h2 {
    padding: 20px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.activity-item:hover {
    background: #f9fafb;
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    background: #f0f9ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    font-size: 14px;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.activity-time {
    font-size: 12px;
    color: #6b7280;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.visitor-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.visitor-type.human {
    background: #dcfce7;
    color: #166534;
}

.visitor-type.bot {
    background: #fef3c7;
    color: #92400e;
}

/* Country Flag */
.country-flag {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
}

/* URL Shortener Form */
.url-shortener-form {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.flex-grow {
    flex: 1;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
}

.form-group input[type="url"],
.form-group input[type="text"] {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.shortened-result {
    background: #f0f9ff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #bae6fd;
    margin-bottom: 30px;
}

.shortened-result h3 {
    color: #0284c7;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-url {
    display: flex;
    gap: 8px;
}

.result-url input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #bae6fd;
    border-radius: 8px;
    background: white;
    font-size: 16px;
}

/* URL List */
.url-list-section {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.url-list-section h2 {
    padding: 20px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}

.url-list {
    max-height: 400px;
    overflow-y: auto;
}

.url-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}

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

.url-info {
    flex: 1;
}

.url-short {
    font-weight: 600;
    color: #0284c7;
    margin-bottom: 4px;
}

.url-original {
    font-size: 14px;
    color: #6b7280;
    word-break: break-all;
}

.url-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #6b7280;
}

.url-actions {
    display: flex;
    gap: 8px;
}

.url-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.copy-btn:hover {
    background: #e5e7eb;
}

.delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

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

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.analytics-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.analytics-card h3 {
    padding: 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}

.chart-container {
    padding: 20px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.country-list,
.os-list {
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.country-item,
.os-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.country-item:last-child,
.os-item:last-child {
    border-bottom: none;
}

.country-info,
.os-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.country-count,
.os-count {
    font-weight: 600;
    color: #374151;
}

/* Data Table */
.visits-table {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

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

.data-table tbody tr:hover {
    background: #f9fafb;
}

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

/* Filter Select */
.filter-select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-human {
    background: #dcfce7;
    color: #166534;
}

.status-bot {
    background: #fef3c7;
    color: #92400e;
}

.status-proxy {
    background: #fee2e2;
    color: #dc2626;
}

.status-hosting {
    background: #fdf4ff;
    color: #a21caf;
}

/* Device indicators */
.device-mobile { color: #059669; }
.device-tablet { color: #7c3aed; }
.device-desktop { color: #2563eb; }

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #d1d5db;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
        border-right: none;
        border-top: 1px solid #e5e7eb;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 20px;
    }
    
    .nav-item {
        white-space: nowrap;
        border-right: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-item.active {
        border-right: none;
        border-bottom-color: #0284c7;
    }
    
    .main-content {
        order: 1;
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .notification-panel {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .header-content {
        padding: 0 16px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 16px;
    }
    
    .login-form {
        padding: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .url-actions {
        flex-direction: column;
        gap: 4px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Print styles */
@media print {
    .sidebar,
    .dashboard-header,
    .notification-panel,
    .url-actions,
    .section-actions {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .content-section {
        display: block !important;
    }
}
