/**
 * Custom Affiliate System - Frontend Styles
 * Modern, responsive styling for affiliate pages
 * 
 * @author Nasir Nishat - SaaS Ventur
 * @website https://www.saasventur.com
 */

/* Reset and Base Styles */
.affiliate-page-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #0f172a;
    background: #ffffff;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

.affiliate-registration-container,
.affiliate-dashboard,
.affiliate-coupons {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #0f172a;
    background: #ffffff;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .affiliate-page-wrapper,
    .affiliate-registration-container,
    .affiliate-dashboard,
    .affiliate-coupons {
        max-width: 100%;
        padding: 12px;
        margin: 0;
    }
    
    .affiliate-page-wrapper .affiliate-registration-container {
        margin: 8px 0;
        border-radius: 4px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .affiliate-page-wrapper,
    .affiliate-registration-container,
    .affiliate-dashboard,
    .affiliate-coupons {
        padding: 8px;
    }
    
    .affiliate-page-wrapper .affiliate-registration-container {
        margin: 4px 0;
        border-radius: 2px;
    }
    
    .affiliate-form {
        padding: 12px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        min-height: 42px;
    }
    
    .btn {
        padding: 10px 16px;
        min-height: 44px;
        font-size: 15px;
    }
}

/* Mobile Touch Optimizations */
@media (max-width: 768px) {
    /* Improve touch targets */
    .tab-button {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better scrolling on mobile */
    .affiliate-page-wrapper {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    /* Prevent horizontal scroll */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure consistent width across languages */
    .affiliate-page-wrapper,
    .affiliate-registration-container,
    .affiliate-dashboard,
    .affiliate-coupons {
        width: 100% !important;
        max-width: 600px !important;
        margin: 0 auto !important;
        padding: 12px !important;
    }
    
    /* Improve text readability */
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .form-help {
        font-size: 0.8rem;
        margin-top: 6px;
    }
    
    /* Better spacing for mobile */
    .terms-section {
        margin: 12px 0;
    }
    
    .checkbox-label {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    /* Dashboard Mobile */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .affiliate-info {
        flex-direction: row;
        gap: 6px;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-card .stat-header {
        gap: 6px;
    }
    
    .stat-icon {
        font-size: 0.875rem;
    }
    
    .stat-content h3 {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    /* Dashboard Sections Mobile */
    .dashboard-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .dashboard-section h3 {
        font-size: 0.875rem;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    
    .sales-table th,
    .sales-table td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    /* Dashboard Actions Mobile */
    .dashboard-actions {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .action-button {
        padding: 10px 12px;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .action-icon {
        font-size: 0.875rem;
    }
    
    /* Coupons Mobile */
    .coupons-header {
        margin-bottom: 16px;
    }
    
    .coupons-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .coupon-card {
        padding: 16px;
    }
    
    .coupon-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .coupon-code-section {
        width: 100%;
    }
    
    .coupon-code {
        font-size: 1.125rem;
    }
    
    .coupon-discount {
        font-size: 0.8rem;
    }
    
    .coupon-info {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 10px;
    }
    
    .info-label {
        font-size: 0.8rem;
    }
    
    .info-value {
        font-size: 0.8rem;
    }
    
    .coupon-stats {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .stat {
        padding: 10px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .coupon-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .coupon-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    
    /* Back Button Mobile */
    .back-navigation {
        margin-bottom: 16px;
        padding: 8px 0;
    }
    
    .back-button {
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    /* Messages Mobile */
    .affiliate-message {
        padding: 10px 12px;
        margin: 12px 0;
    }
    
    .affiliate-message p {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
}

/* Container improvements */
.affiliate-page-wrapper .affiliate-registration-container {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin: 16px auto;
}

.affiliate-page-wrapper .affiliate-dashboard {
    background: transparent;
    padding: 0;
}

.affiliate-page-wrapper .affiliate-coupons {
    background: transparent;
    padding: 0;
}

/* Ensure consistent width for coupon pages across all languages */
.affiliate-coupons {
    max-width: 600px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Messages - Enhanced visibility */
.affiliate-message {
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 6px;
    border: 1px solid;
    font-weight: 500;
    position: relative;
    text-align: center;
}

.affiliate-message p {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
}

.affiliate-message.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.affiliate-message.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.affiliate-message.info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0c4a6e;
}

/* Language Switcher */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.lang-switch {
    display: inline-block;
    padding: 8px 16px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.lang-switch:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

/* Hide language switcher on affiliate pages */
.affiliate-registration-container .language-switcher,
.affiliate-dashboard-container .language-switcher,
.affiliate-coupons-container .language-switcher,
.affiliate-page-wrapper .language-switcher {
    display: none !important;
}

/* Hide English language switcher on Korean pages */
body:not(.lang-en) .language-switcher {
    display: none !important;
}


/* Back Navigation */
.back-navigation {
    margin-bottom: 20px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f9fafb;
    color: #6b7280;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.back-button:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

/* Registration Form */
.affiliate-registration-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.affiliate-registration-header h2 {
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 1.875rem;
    font-weight: 600;
    line-height: 1.2;
}

.affiliate-registration-header p {
    color: #64748b;
    font-size: 0.875rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Mobile Header */
@media (max-width: 768px) {
    .affiliate-registration-header {
        margin-bottom: 16px;
    }
    
    .affiliate-registration-header h2 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }
    
    .affiliate-registration-header p {
        font-size: 0.8rem;
        max-width: 100%;
    }
}

/* Tabs */
.affiliate-registration-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.tab-button {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    border-radius: 4px 4px 0 0;
}

.tab-button.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
    background: #f8fafc;
}

.tab-button:hover {
    color: #0f172a;
    background: #f1f5f9;
}

/* Mobile Tabs */
@media (max-width: 768px) {
    .affiliate-registration-tabs {
        margin-bottom: 16px;
    }
    
    .tab-button {
        padding: 10px 12px;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }
}

.tab-content {
    display: none;
}

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

/* Forms - Enhanced visibility */
.affiliate-form {
    background: #ffffff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

/* Mobile Forms */
@media (max-width: 768px) {
    .affiliate-form {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #0f172a;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #ffffff;
    color: #0f172a;
    font-weight: 400;
}

/* Mobile Input Fields */
@media (max-width: 768px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Touch-friendly minimum height */
    }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #9ca3af;
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #64748b;
}

/* Bank Details Section */
.bank-details-section {
    background: #f8fafc;
    padding: 16px;
    border-radius: 4px;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}

.bank-details-section h3 {
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 600;
}

/* Mobile Bank Details */
@media (max-width: 768px) {
    .bank-details-section {
        padding: 12px;
        margin: 12px 0;
    }
    
    .bank-details-section h3 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
}

.section-description {
    color: #64748b;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

/* Terms Section */
.terms-section {
    margin: 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #64748b;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    margin-top: 2px;
}

.checkbox-label a {
    color: #0f172a;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.checkbox-label a:hover {
    text-decoration: none;
}

/* Buttons - Enhanced visibility */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
}

/* Mobile Buttons */
@media (max-width: 768px) {
    .btn {
        padding: 12px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px; /* Touch-friendly minimum height */
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-large {
        padding: 16px 24px;
        min-height: 52px;
    }
}

.btn-primary {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
}

.btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.btn-secondary {
    background: #f8fafc;
    color: #0f172a;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #9ca3af;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 28px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 0.875rem;
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    margin-right: 6px;
    font-size: 1em;
}

/* Form Actions */
.form-actions {
    text-align: right;
    margin-top: 16px;
}

.form-messages {
    margin-top: 12px;
}

.message {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.message.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message ul {
    margin: 4px 0 0 16px;
}

/* Benefits Section */
.affiliate-benefits {
    background: #f8fafc;
    padding: 16px;
    border-radius: 4px;
    margin-top: 20px;
    border: 1px solid #e2e8f0;
}

.affiliate-benefits h3 {
    color: #0f172a;
    margin-bottom: 12px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

/* Mobile Benefits */
@media (max-width: 768px) {
    .affiliate-benefits {
        padding: 12px;
        margin-top: 16px;
    }
    
    .affiliate-benefits h3 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
}

.affiliate-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.affiliate-benefits li {
    padding: 6px 0;
    color: #64748b;
    position: relative;
    padding-left: 20px;
    font-size: 0.875rem;
}

.affiliate-benefits li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.dashboard-header h2 {
    color: #111827;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.affiliate-info {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
}

.affiliate-code {
    background: #111827;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.75rem;
}

.commission-rate {
    background: #f9fafb;
    color: #374151;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.75rem;
    border: 1px solid #e5e7eb;
}

/* Stats Cards - Compact Design */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    background: #ffffff;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
}

.stat-card:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.stat-card .stat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.stat-icon {
    font-size: 1rem;
    color: #6b7280;
}

.stat-content h3 {
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
}

/* Dashboard Actions */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    gap: 6px;
    min-height: 44px;
}

.action-button:hover {
    border-color: #9ca3af;
    background: #f9fafb;
    color: #111827;
}

.action-icon {
    font-size: 1rem;
    color: #6b7280;
}

/* Request Status Card */
.request-status-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.request-status-header h4 {
    margin: 0;
    color: #111827;
    font-size: 1.125rem;
    font-weight: 600;
}

.request-details {
    margin-bottom: 16px;
}

.request-details p {
    margin: 8px 0;
    color: #374151;
    font-size: 0.875rem;
}

.request-message, .admin-response {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    font-style: italic;
    color: #374151;
}

.admin-response.rejected {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.admin-response.approved {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.request-actions, .request-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.request-info p {
    margin: 0;
    color: #6b7280;
    font-style: italic;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Request Status Section */
.request-status-section {
    margin: 24px 0;
}

.request-status-section h3 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

/* Requests History Section */
.requests-history-section {
    margin: 24px 0;
}

.requests-history-section h3 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.requests-table {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.requests-table .table-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: #f8f9fa;
    padding: 16px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.requests-table .table-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.requests-table .table-row:hover {
    background: #f9fafb;
}

.requests-table .table-row:last-child {
    border-bottom: none;
}


.requests-table .col-message {
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 8px 0;
}

.requests-table .col-message .request-message {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #d1d5db;
    margin: 4px 0 12px 0;
    font-style: italic;
    color: #4b5563;
}

.requests-table .col-message .no-message {
    color: #9ca3af;
    font-style: italic;
    margin-bottom: 12px;
}

.requests-table .message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.requests-table .request-date {
    font-size: 0.7rem;
    color: #6b7280;
}

.requests-table .request-status {
    font-size: 0.7rem;
}

.requests-table .request-status .status-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
}


.requests-table .col-response {
    font-size: 0.85rem;
    line-height: 1.4;
}

.requests-table .col-response .admin-response {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 4px 0;
}

.requests-table .col-response .admin-response.approved {
    background: #d1fae5;
    color: #065f46;
    border-left: 3px solid #10b981;
}

.requests-table .col-response .admin-response.rejected {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

.requests-table .col-response .no-response {
    color: #9ca3af;
    font-style: italic;
}


/* Coupon Request Section */
.coupon-request-section {
    margin: 24px 0;
    padding: 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.coupon-request-section h3 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.coupon-request-section p {
    color: #6b7280;
    margin-bottom: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .request-status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .request-status-card {
        padding: 16px;
        margin: 16px 0;
    }
    
    /* Mobile Requests Table */
    .requests-table .table-header {
        display: none;
    }
    
    .requests-table .table-row {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 16px;
        background: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .requests-table .col-message {
        margin-bottom: 12px;
    }
    
    .requests-table .col-response {
        margin-bottom: 12px;
    }
    
    .requests-table .col-message:before {
        content: "Message: ";
        font-weight: 600;
        color: #6b7280;
        display: block;
        margin-bottom: 6px;
        font-size: 0.8rem;
    }
    
    .requests-table .col-response:before {
        content: "Response: ";
        font-weight: 600;
        color: #6b7280;
        display: block;
        margin-bottom: 4px;
        font-size: 0.8rem;
    }
    
    .requests-table .message-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .requests-table .request-date {
        font-size: 0.65rem;
    }
    
    .requests-table .request-status {
        font-size: 0.65rem;
    }
}
    
    .coupon-request-section {
        padding: 16px;
        margin: 16px 0;
    }

/* Dashboard Sections */
.dashboard-section {
    background: white;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.dashboard-section h3 {
    color: #111827;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
}

/* Tables */
.sales-table-container {
    overflow-x: auto;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.875rem;
}

.sales-table th,
.sales-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.sales-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sales-table td {
    color: #6b7280;
}

.sales-table code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-paid {
    background: #d1ecf1;
    color: #0c5460;
}

.no-data {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px;
}

/* Chart Container */
.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

/* Coupons Header */
.coupons-header {
    position: relative;
    margin-bottom: 20px;
    text-align: center;
}

.coupons-header h2 {
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 600;
}

.coupons-header p {
    color: #64748b;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* Coupons Grid */
.coupons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.coupon-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.coupon-card:hover {
    border-color: #9ca3af;
}

.coupon-card.expired {
    opacity: 0.6;
    border-color: #fecaca;
    background: #fef2f2;
}

.coupon-card.usage-limited {
    border-color: #fbbf24;
    background: #fffbeb;
}

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

.coupon-code-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.coupon-icon {
    font-size: 1.5rem;
    color: #6b7280;
}

.coupon-details {
    flex: 1;
}

.coupon-code {
    margin: 0 0 4px 0;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.coupon-discount {
    color: #059669;
    font-size: 0.875rem;
    font-weight: 600;
    background: #ecfdf5;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.coupon-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.coupon-status.status-publish {
    background: #d4edda;
    color: #155724;
}

.coupon-status.status-draft {
    background: #fff3cd;
    color: #856404;
}

.coupon-info {
    background: #f8fafc;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.info-value {
    font-size: 0.875rem;
    color: #111827;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.coupon-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    text-align: center;
    background: #ffffff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

.coupon-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    justify-content: center;
}


.no-coupons {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-coupons-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-coupons h3 {
    color: #333;
    margin-bottom: 10px;
}

/* Modal Styles - Simple Modern */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    text-align: left;
}

.modal-content {
    background: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    display: block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.close {
    font-size: 2rem;
    font-weight: 400;
    color: #666;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close:hover {
    color: #333;
    background: #f8f9fa;
}

.modal-body {
    padding: 32px;
    background: #ffffff;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

/* Modal Form Enhancements */
.modal .form-group {
    margin-bottom: 28px;
}

.modal .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
}

.modal .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.modal .form-group label {
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background: #ffffff;
    color: #333;
    min-height: 44px;
    box-sizing: border-box;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
    outline: none;
    border-color: #007cba;
}

.modal .form-help {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 4px;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* Modal Button Enhancements */
.modal .btn {
    margin: 0;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    min-width: 100px;
}

.modal .form-actions {
    text-align: right;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Modal Messages */
.modal .form-messages {
    margin-top: 15px;
}

.modal .message {
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-weight: 400;
}

.modal .message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal .message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal Focus Management */
.modal:focus {
    outline: none;
}

/* Coupon Preview */
.coupon-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #e9ecef;
}

.coupon-preview h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
}

.preview-coupon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.preview-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #007cba;
    font-size: 1.1rem;
}

.preview-discount {
    background: #007cba;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .affiliate-registration-container,
    .affiliate-dashboard,
    .affiliate-coupons {
        padding: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .affiliate-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
    }
    
    .coupons-grid {
        grid-template-columns: 1fr;
    }
    
    .coupon-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .coupon-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
        max-height: 96vh;
        max-width: 100%;
    }
    
    .modal .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .close {
        width: 30px;
        height: 30px;
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .affiliate-registration-header h2 {
        font-size: 2rem;
    }
    
    .affiliate-form {
        padding: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
        max-height: 96vh;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .close {
        width: 28px;
        height: 28px;
        font-size: 1.6rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Loading States */
.btn-loading {
    display: none;
}

.btn:disabled .btn-text {
    display: none;
}

.btn:disabled .btn-loading {
    display: inline;
}

/* Loading States - Enhanced */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Enhanced visibility for tables */
.sales-table {
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.sales-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    font-size: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.sales-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 400;
    font-size: 0.875rem;
    color: #6b7280;
}

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

/* Enhanced form validation */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #dc3545;
    background: #fff5f5;
}

.form-group.error label {
    color: #dc3545;
}

.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 5px;
    font-weight: 500;
}

/* Coupon Type Selection */
.coupon-type-selection {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex: 1;
}

.radio-option:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    margin-top: 2px;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #000;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #000;
    background-color: #f8f9fa;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-label strong {
    font-weight: 600;
    color: #0f172a;
}

.radio-label small {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Product Selection */
.product-selection {
    margin-top: 16px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

/* Text overflow and word wrapping for Korean */
.action-button,
.stat-content h3,
.dashboard-section h3,
.coupons-header h2,
.affiliate-registration-header h2 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Ensure consistent text sizing across languages */
.action-button {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Coupon code input styling - auto uppercase */
#coupon_code {
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 1px;
}

#coupon_code::placeholder {
    text-transform: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    letter-spacing: normal;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .affiliate-form,
    .stat-card,
    .sales-table {
        border: 2px solid #000;
    }
    
    .btn-primary {
        background: #000;
        color: #fff;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        border: 2px solid #000;
    }
}
