/* Active Rounds Specific Styles */

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.btn-primary.paused {
    background: var(--success-color);
}

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

.timer strong {
    color: var(--primary-color);
    font-size: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.stat-card:nth-child(3) .stat-value {
    color: white;
}

.stat-card:nth-child(3) .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

thead {
    background: var(--primary-color);
    color: white;
}

th {
    padding: 18px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr.expanded {
    background-color: var(--hover-bg);
}

td {
    padding: 18px;
    color: var(--text-primary);
    font-size: 14px;
}

.details-row {
    display: none;
    background: var(--hover-bg);
}

.details-row.show {
    display: table-row;
}

.details-content {
    padding: 20px;
    border-top: 2px solid var(--border-color);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-section {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-section h4 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.detail-label {
    color: var(--text-muted);
    font-size: 13px;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

/* Balls Section Styles */
.balls-section {
    text-align: center;
}

.balls-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
    margin: 15px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    border-radius: 12px;
}

body.dark-mode .balls-counter {
    background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
}

.balls-count {
    font-size: 48px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.balls-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balls-note {
    margin-top: 10px;
}

.info-text {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.loading-details {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

/* Skeleton Loading */
.skeleton-row td {
    padding: 16px;
}

.skeleton-text {
    height: 16px;
    background: #e0e0e0;
    border-radius: 4px;
    animation: pulse 1.5s infinite ease-in-out;
}

.skeleton-card .skeleton-text {
    background: #e0e0e0;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* Flash Updates */
@keyframes flash-highlight {
    0% {
        background-color: rgba(255, 215, 0, 0.4);
        /* Gold with transparency */
    }

    100% {
        background-color: transparent;
    }
}

.flash-update {
    animation: flash-highlight 1s ease-out;
}

/* Dark mode adjustment for flash */
@media (prefers-color-scheme: dark) {
    @keyframes flash-highlight {
        0% {
            background-color: rgba(255, 215, 0, 0.25);
        }

        100% {
            background-color: transparent;
        }
    }
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 20px;
}

.metrics-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.metrics-card h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--hover-bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.metric-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
}

.loading,
.empty,
.error {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-style: italic;
}

.error {
    color: #e53e3e;
}

.round-id {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--hover-bg);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.room-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.players-count {
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

.state-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.state-playing {
    background: #c6f6d5;
    color: #22543d;
}

.prizes-list {
    list-style: none;
}

.prize-item {
    padding: 4px 0;
    font-size: 13px;
}

.prize-phase {
    font-weight: 600;
    color: #667eea;
}

.prize-amount {
    color: #48bb78;
    font-weight: 600;
}

/* Tablet Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        gap: 10px;
    }

    .filter-input,
    .filter-select {
        min-width: 150px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    .back-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .back-text {
        font-size: 13px;
    }

    h1 {
        font-size: 22px;
    }

    .controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .timer {
        width: 100%;
        text-align: left;
        margin-top: 10px;
        font-size: 13px;
    }

    .filters {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }

    .filter-input,
    .filter-select {
        width: 100%;
        min-width: auto;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 11px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-item {
        padding: 12px;
    }

    .metric-value {
        font-size: 18px;
    }

    /* Mobile Card View */
    .table-container {
        overflow-x: auto;
    }

    table {
        display: none;
    }

    .mobile-cards {
        display: block;
        padding: 15px;
    }

    .mobile-card {
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 15px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

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

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-card-title {
        font-weight: 600;
        color: var(--text-primary);
        font-size: 16px;
    }

    .mobile-card-body {
        display: grid;
        gap: 8px;
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
    }

    .mobile-card-label {
        color: var(--text-muted);
        font-size: 13px;
    }

    .mobile-card-value {
        color: var(--text-primary);
        font-weight: 600;
        font-size: 13px;
    }

    .pagination {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
        justify-content: center;
    }

    .pagination button {
        flex: 0 1 auto;
    }

    #pageInfo {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    header {
        padding: 15px;
        gap: 15px;
    }

    h1 {
        font-size: 18px;
        line-height: 1.3;
    }

    .connection-status {
        font-size: 11px;
        padding: 4px 10px;
    }

    .controls {
        gap: 8px;
    }

    .btn {
        font-size: 12px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .btn-icon {
        padding: 8px 12px;
        font-size: 16px;
    }

    .timer {
        font-size: 12px;
    }

    .timer strong {
        font-size: 14px;
    }

    .filters {
        padding: 12px;
        gap: 8px;
    }

    .filter-input,
    .filter-select {
        font-size: 13px;
        padding: 8px 12px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 10px;
    }

    .metrics-card {
        padding: 15px;
    }

    .metrics-card h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .metric-item {
        padding: 10px;
    }

    .metric-label {
        font-size: 11px;
    }

    .metric-value {
        font-size: 16px;
    }

    .mobile-cards {
        padding: 10px;
    }

    .mobile-card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .mobile-card-title {
        font-size: 14px;
    }

    .mobile-card-label,
    .mobile-card-value {
        font-size: 12px;
    }

    .pagination {
        padding: 12px;
        gap: 8px;
    }

    .pagination button {
        font-size: 12px;
        padding: 8px 12px;
    }

    #pageInfo {
        font-size: 12px;
    }

    /* Balls Section Mobile */
    .balls-count {
        font-size: 36px;
    }

    .balls-label {
        font-size: 12px;
    }

    .balls-counter {
        padding: 15px 0;
        margin: 10px 0;
    }

    .info-text {
        font-size: 12px;
    }
}

/* Desktop: Hide mobile cards */
@media (min-width: 769px) {
    .mobile-cards {
        display: none;
    }
}


.filters {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input,
.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    flex: 1;
    min-width: 200px;
    background: var(--card-bg);
    color: var(--text-primary);
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: #5568d3;
}

.sort-icon {
    font-size: 12px;
    opacity: 0.5;
}

.sortable.active .sort-icon {
    opacity: 1;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--hover-bg);
    border-top: 1px solid var(--border-color);
}

#pageInfo {
    color: var(--text-secondary);
    font-weight: 600;
}

.loading,
.empty,
.error {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

.error {
    color: #e53e3e;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--hover-bg) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-row {
    display: flex;
    gap: 15px;
    padding: 18px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-cell {
    height: 20px;
    flex: 1;
}

.skeleton-cell.small {
    flex: 0.5;
}

.skeleton-cell.large {
    flex: 1.5;
}

.skeleton-stat {
    height: 36px;
    width: 80%;
    margin: 0 auto 8px;
}

.skeleton-label {
    height: 14px;
    width: 60%;
    margin: 0 auto;
}