/* HID Affiliates Modern Frontend Dashboard Styles */

/* CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --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;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
.hid-affiliates-modern-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--gray-800);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Icons */
.hid-affiliates-modern-dashboard [class*="icon-"]:before {
    font-family: dashicons;
    font-size: 16px;
    text-decoration: inherit;
    font-weight: normal;
    font-style: normal;
    vertical-align: top;
    text-align: center;
    transition: var(--transition);
}

.icon-users:before { content: "\f307"; }
.icon-eye:before { content: "\f177"; }
.icon-shopping-cart:before { content: "\f174"; }
.icon-link:before { content: "\f103"; }
.icon-download:before { content: "\f316"; }
.icon-refresh:before { content: "\f463"; }
.icon-arrow-up:before { content: "\f343"; }
.icon-copy:before { content: "\f105"; }
.icon-qrcode:before { content: "\f236"; }

/* Custom QR code icon styling for better appearance */
.btn-qr .icon-qrcode:before {
    content: "\f489"; /* Using grid/screenoptions icon which looks more like QR */
    transform: rotate(0deg);
    display: inline-block;
}

/* Alternative: Use a better grid-like appearance */
.btn-qr:hover .icon-qrcode:before {
    transform: scale(1.1);
}

/* Header */
.dashboard-header {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.welcome-section h1 {
    margin: 0 0 10px 0;
    font-size: 2.25rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    margin: 0;
    font-size: 1.125rem;
    color: var(--gray-600);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-copy {
    background: var(--info-color);
    color: var(--white);
}

.btn-qr {
    background: var(--gray-600);
    color: var(--white);
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.stat-card.success::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.warning::before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card.info::before {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: var(--white);
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card.success .stat-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card.info .stat-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--gray-800);
}

.stat-label {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

.stat-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success-color);
}

/* Charts Section */
.charts-section {
    margin-bottom: 40px;
}

.chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-row:last-child {
    grid-template-columns: 1fr 1fr;
}

.chart-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.chart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.chart-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.chart-controls select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: var(--white);
    color: var(--gray-700);
}

.chart-body {
    padding: 24px;
    position: relative;
    min-height: 200px;
}

/* URLs Section */
.urls-section {
    margin-bottom: 40px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.section-subtitle {
    margin: 0;
    color: var(--gray-600);
}

.urls-table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.urls-table th {
    background: var(--gray-50);
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.urls-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.urls-table tbody tr:hover {
    background: var(--gray-50);
}

.url-cell {
    max-width: 300px;
}

.url-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.url-title {
    font-weight: 500;
    color: var(--gray-800);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.url-generated {
    font-size: 12px;
    color: var(--gray-500);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visitors-cell {
    text-align: center;
}

.visitor-count {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--white);
    margin: 10% auto;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.qr-code-container {
    margin-bottom: 20px;
}

.qr-code-container img {
    max-width: 200px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.qr-url {
    background: var(--gray-100);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    word-break: break-all;
    margin: 0;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hid-affiliates-modern-dashboard {
        padding: 15px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .welcome-section h1 {
        font-size: 1.875rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-row {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .urls-table-container {
        overflow-x: auto;
    }
    
    .urls-table {
        min-width: 600px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .welcome-section h1 {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    .chart-body {
        padding: 16px;
    }
    
    .urls-table th,
    .urls-table td {
        padding: 12px 16px;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    margin-bottom: 8px;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Success/Error Messages */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: var(--white);
    font-weight: 500;
    z-index: 10000;
    animation: toastSlideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

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

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

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Chart Overrides */
.chart-body canvas {
    max-height: 300px !important;
}

/* Print Styles */
@media print {
    .header-actions,
    .actions-cell,
    .modal,
    .loading-overlay {
        display: none !important;
    }
    
    .hid-affiliates-modern-dashboard {
        background: white !important;
        color: black !important;
    }
    
    .stat-card,
    .chart-container,
    .urls-table-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}
