/* KQBD Matches Widget Styles - Vertical Card Layout - Dark Theme */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a1a2e;
}

.kqbd-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    padding: 8px;
    max-width: 400px;
    margin: 0 auto;
}

/* Header */
.kqbd-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px 8px 8px;
}

.kqbd-header-icon {
    font-size: 16px;
}

.kqbd-header-title {
    color: #10b981;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

/* ========== DATE FILTER ========== */
.kqbd-date-filter {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    margin-bottom: 8px;
    cursor: pointer;
}

.kqbd-date-picker {
    width: 100%;
    padding: 8px 12px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.kqbd-date-picker:hover {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

.kqbd-date-picker:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Make the calendar picker indicator cover entire input for better clickability */
.kqbd-date-picker::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Loading */
.kqbd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 10px;
    background: transparent;
}

.kqbd-spinner {
    font-size: 24px;
    animation: kqbd-spin 1s linear infinite;
}

.kqbd-spinner::before {
    content: '\26BD';
}

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

.kqbd-loading-text {
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 500;
}

/* Empty State */
.kqbd-empty {
    padding: 32px;
    text-align: center;
    color: #e5e7eb;
    font-size: 12px;
    background: #252540;
    border-radius: 5px;
    border: 1px solid #3d3d5c;
}

/* ========== MATCHES LIST ========== */
.kqbd-matches-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* ========== MATCH CARD STYLES ========== */
.kqbd-match-card {
    background: #252540;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #3d3d5c;
}

.kqbd-match-card:hover {
    transform: translateY(-1px);
    border-color: #10b981;
}

/* League Header */
.kqbd-league-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #1e1e38;
    border-bottom: 1px solid #3d3d5c;
}

.kqbd-league-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    background: #fff;
    border-radius: 3px;
}

.kqbd-league-name {
    font-size: 10px;
    font-weight: 600;
    color: #e5e7eb;
}

/* Match Content */
.kqbd-match-content {
    padding: 8px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

/* Team Section */
.kqbd-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.kqbd-team-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Score Center */
.kqbd-score-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 50px;
}

.kqbd-score-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kqbd-score-home,
.kqbd-score-away {
    font-size: 18px;
    font-weight: 800;
    color: #e5e7eb;
    min-width: 24px;
    text-align: center;
}

.kqbd-score-home.winner {
    color: #10b981;
}

.kqbd-score-away.winner {
    color: #10b981;
}

.kqbd-score-separator {
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
}

.kqbd-match-date {
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
}

.kqbd-ft-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #10b981;
    color: #ffffff;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Team Names Footer */
.kqbd-teams-footer {
    display: flex;
    align-items: stretch;
}

.kqbd-team-name-box {
    flex: 1;
    padding: 5px 8px;
    background: #3d3d5c;
    color: #e5e7eb;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kqbd-team-name-box.home {
    border-radius: 0 0 0 5px;
}

.kqbd-team-name-box.away {
    border-radius: 0 0 5px 0;
}

.kqbd-team-name-box.winner {
    background: #10b981;
    color: #ffffff;
}

/* ========== RESPONSIVE STYLES ========== */
@media (max-width: 480px) {
    .kqbd-container {
        border-radius: 0;
        padding: 8px;
    }

    .kqbd-header-title {
        font-size: 14px;
    }

    .kqbd-date-filter {
        padding: 6px 0;
        margin-bottom: 8px;
    }

    .kqbd-date-picker {
        padding: 8px 12px;
        font-size: 12px;
    }

    .kqbd-team-logo {
        width: 36px;
        height: 36px;
    }

    .kqbd-score-home,
    .kqbd-score-away {
        font-size: 18px;
    }

    .kqbd-team-name-box {
        font-size: 10px;
        padding: 6px 8px;
    }
}

/* ========== POPUP STYLES ========== */
.kqbd-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 2147483647 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: kqbd-fadeIn 0.2s ease;
}

@keyframes kqbd-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.kqbd-popup {
    background: #252540;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    z-index: 2147483647 !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    border: 1px solid #3d3d5c;
    animation: kqbd-popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kqbd-popupIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.kqbd-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin: 0;
    min-height: auto;
    padding: 0;
}

.kqbd-popup-close:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.1);
}

.kqbd-popup-content {
    overflow-y: auto;
    max-height: 85vh;
}

/* Popup Header */
.popup-header {
    background: #1e1e38;
    padding: 14px 12px;
    position: relative;
}

.popup-league {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.popup-league-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.popup-league-name {
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
}

.popup-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.popup-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.popup-team-logo-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 3px;
    background: rgba(255, 255, 255, 0.1);
}

.popup-team-logo-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #252540;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.popup-team-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.popup-team-name {
    font-size: 10px;
    font-weight: 600;
    color: #e5e7eb;
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-score-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
}

.popup-score-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #3d3d5c;
}

.popup-score-digit {
    font-size: 22px;
    font-weight: 800;
    color: #e5e7eb;
}

.popup-score-digit.winner {
    color: #10b981;
}

.popup-score-separator {
    font-size: 18px;
    font-weight: 700;
    color: #6b7280;
}

.popup-ft-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #10b981;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.popup-ht-score {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 600;
}

/* Popup Body */
.popup-body {
    padding: 0;
    background: #252540;
}

/* Events Section */
.popup-events-section {
    padding: 12px;
}

.popup-events-title {
    font-size: 11px;
    font-weight: 700;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #3d3d5c;
}

.popup-events-title::before {
    content: '⚡';
    font-size: 12px;
}

.popup-events-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

/* New Event Row Styles */
.popup-event-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.popup-event-row:hover {
    background: rgba(16, 185, 129, 0.1) !important;
}

.popup-goal-event {
    border-left: 3px solid #10b981;
}

/* Time Column */
.popup-event-time-col {
    min-width: 40px;
}

.popup-time-badge {
    display: inline-block;
    font-weight: 800;
    color: #10b981;
    font-size: 12px;
}

/* Event Icon Cell */
.popup-event-icon-cell {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-event-icon {
    font-size: 14px;
}

/* Team Logo Column */
.popup-event-team-col {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 30px;
}

.popup-event-team-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 50%;
}

.popup-team-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.popup-home-team {
    background: #10b981;
}

.popup-away-team {
    background: #ef4444;
}

/* Player Details Column */
.popup-event-player-col {
    flex: 1;
    min-width: 0;
}

.popup-player-name {
    font-size: 11px;
    font-weight: 600;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.popup-goal-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #10b981;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.popup-assist-info {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 10px;
}

.popup-assist-arrow {
    color: #10b981;
    font-weight: 600;
}

.popup-assist-name {
    color: #10b981;
    font-weight: 500;
}

.popup-assist-label {
    color: #6b7280;
    font-style: italic;
}

/* Event Badge Column */
.popup-event-badge-col {
    min-width: 80px;
    text-align: right;
}

.popup-event-type-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
}

/* Legacy styles for backwards compatibility */
.popup-event-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1e1e38;
    border-radius: 6px;
    font-size: 10px;
}

.popup-event-item.home {
    border-left: 3px solid #10b981;
}

.popup-event-item.away {
    border-left: 3px solid #ef4444;
}

.popup-event-time {
    font-weight: 700;
    color: #10b981;
    min-width: 30px;
    font-size: 11px;
}

.popup-event-player {
    flex: 1;
    color: #e5e7eb;
    font-weight: 500;
}

.popup-events-empty {
    text-align: center;
    padding: 24px;
    color: #6b7280;
    font-size: 11px;
    background: #1e1e38;
    border-radius: 6px;
}

/* Loading in Popup */
.popup-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 12px;
    gap: 10px;
}

.popup-loading-spinner {
    font-size: 22px;
    animation: kqbd-spin 1s linear infinite;
}

.popup-loading-text {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

/* Popup Responsive */
@media (max-width: 480px) {
    .kqbd-popup {
        max-width: 100%;
        margin: 6px;
        border-radius: 10px;
    }

    .popup-header {
        padding: 12px 10px;
    }

    .popup-team-logo-wrapper {
        width: 40px;
        height: 40px;
    }

    .popup-score-digit {
        font-size: 18px;
    }

    .popup-team-name {
        font-size: 9px;
        max-width: 70px;
    }

    /* Event row responsive */
    .popup-event-row {
        padding: 6px 8px;
        gap: 6px;
    }

    .popup-event-time-col {
        min-width: 32px;
    }

    .popup-time-badge {
        font-size: 10px;
    }

    .popup-event-icon-cell {
        width: 24px;
        height: 24px;
    }

    .popup-event-icon {
        font-size: 12px;
    }

    .popup-event-team-logo {
        width: 18px;
        height: 18px;
    }

    .popup-player-name {
        font-size: 10px;
    }

    .popup-goal-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    .popup-assist-info {
        font-size: 9px;
    }

    .popup-event-badge-col {
        min-width: 60px;
    }

    .popup-event-type-badge {
        font-size: 8px;
        padding: 2px 6px;
    }
}

/* ========== LOAD MORE BUTTON ========== */
.kqbd-load-more-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 16px;
    padding: 8px 0;
}

.kqbd-load-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.kqbd-load-more-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.kqbd-load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.kqbd-load-more-icon {
    font-size: 16px;
    animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(4px);
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .kqbd-load-more-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}
