/**
 * CTV Portal - Components
 * Buttons, Cards, Badges, Forms, Login
 * Modern Glassmorphism Design
 * 
 * Updated: January 2026
 */

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS - Modern Design
   ═══════════════════════════════════════════════════════════════════ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 14px rgba(79, 125, 243, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 125, 243, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════════════════════════════
   BADGES - Reference Design
   ═══════════════════════════════════════════════════════════════════ */

.badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.user-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.user-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.user-badge.manager {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.user-badge.director {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.user-badge.leader {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.user-badge.gold { 
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.user-badge.silver { 
    background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

.user-badge.bronze { 
    background: linear-gradient(135deg, #fdba74 0%, #c2410c 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Priority Badges from Reference */
.priority-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.priority-badge.low {
    background: #dcfce7;
    color: #16a34a;
}

.priority-badge.medium {
    background: #ffedd5;
    color: #ea580c;
}

.priority-badge.high {
    background: #fee2e2;
    color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM ELEMENTS - Modern Design
   ═══════════════════════════════════════════════════════════════════ */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-blue);
    cursor: pointer;
    border-radius: 4px;
}

.remember-me label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN BOX - Modern Glass Design
   ═══════════════════════════════════════════════════════════════════ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--glass-border);
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(79, 125, 243, 0.3);
}

.login-logo svg {
    width: 40px;
    height: 40px;
}

.login-logo svg path {
    stroke: #ffffff;
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.error-msg {
    color: var(--danger);
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
    display: none;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

.error-msg.show {
    display: block;
}

.back-link {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.back-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.back-link a:hover {
    color: var(--primary-blue);
}

/* Login Success Animation */
.login-success {
    display: none;
    text-align: center;
    padding: 20px;
}

.login-success.show {
    display: block;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.success-checkmark svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkDraw 0.5s ease forwards 0.3s;
}

@keyframes successPop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes checkDraw {
    to { stroke-dashoffset: 0; }
}

.success-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.success-subtext {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   DATE FILTER BUTTONS - Modern Design
   ═══════════════════════════════════════════════════════════════════ */

.btn-filter-preset {
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.btn-filter-preset:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.btn-filter-preset.active {
    background: #ffffff;
    color: var(--primary-blue);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

/* Red Envelope Indicator */
.btn-filter-preset.has-data::after {
    content: '🧧';
    position: absolute;
    top: -10px;
    right: -8px;
    font-size: 18px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
    animation: envelope-float 3s ease-in-out infinite;
    z-index: 10;
    display: block;
}

/* Float animation for the envelope */
@keyframes envelope-float {
    0%, 100% { 
        transform: translateY(0) rotate(5deg);
    }
    50% { 
        transform: translateY(-6px) rotate(-5deg);
    }
}

/* Hide the old indicator elements if they exist in DOM to avoid duplicates */
.btn-filter-preset .data-indicator {
    display: none !important;
}

.btn-filter {
    padding: 10px 24px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 125, 243, 0.3);
}

.btn-filter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 125, 243, 0.4);
}

.date-input {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.date-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.custom-date-filter {
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.date-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

@media (max-width: 768px) {
    .btn-filter-preset {
        padding: 6px 14px;
        font-size: 12px;
    }
    
    .date-filter-row {
        gap: 6px;
    }
    
    .custom-date-filter {
        flex-direction: column;
    }
    
    .custom-date-filter > div {
        flex-direction: column;
        width: 100%;
    }
    
    .date-input {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   LIFETIME STATISTICS TABLE - Modern Design
   ═══════════════════════════════════════════════════════════════════ */

.lifetime-stats-table {
    width: 100%;
}

.stats-table {
    width: 100%;
    border-collapse: separate; /* Changed from collapse for cleaner spacing */
    border-spacing: 0 4px; /* Space between rows */
    margin-top: 8px;
    table-layout: fixed; /* Fixed layout for symmetry */
}

.stats-table thead th {
    text-align: center; /* Center align for symmetry */
    padding: 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.stats-table thead th:first-child {
    text-align: left;
    padding-left: 24px;
}

.stats-table tbody td {
    padding: 16px;
    background: rgba(255, 255, 255, 0.4);
    font-size: 15px; /* Larger font */
    color: var(--text-primary);
    transition: all 0.2s ease;
    text-align: center; /* Center align data */
    white-space: nowrap; /* Prevent wrapping for cleaner look */
    border-bottom: none; /* Remove bottom border in favor of spacing */
}

/* Rounded corners for rows */
.stats-table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    padding-left: 24px;
    text-align: left;
}

.stats-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.stats-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.01); /* Subtle pop effect */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stats-table tbody td:first-child {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Total Row Styling */
.stats-table tbody tr.total-row td {
    background: rgba(255, 255, 255, 0.95);
    font-weight: 800;
    color: var(--text-primary);
    border-top: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.stats-table tbody tr.total-row td:last-child {
    color: var(--success);
}

.stats-table tbody td:last-child {
    font-weight: 700;
    color: var(--text-primary);
}

/* Highlight important values */
.stats-table tbody tr:first-child td:last-child {
    color: var(--success);
    font-size: 16px;
}

@media (max-width: 768px) {
    .stats-table thead th,
    .stats-table tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
}