/* Lottery Results Display Styles */
.lottery-results-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 5px;
    font-family: 'Sarabun', 'Sukhumvit Set', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: #f5f5f5;
}

.lottery-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.lottery-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

.lottery-error {
    background: #ffebee;
    border: 1px solid #ef5350;
    border-radius: 4px;
    padding: 15px;
    color: #c62828;
    margin: 20px 0;
    text-align: center;
}

.lottery-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

.lottery-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.lottery-last-update {
    display: block;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.lottery-section {
    margin-bottom: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.lottery-section-title {
    display: none;
}

.lottery-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0;
    justify-items: center;
}

.lottery-item {
    background: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 350px;
}

.lottery-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.lottery-item-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    border-bottom: none;
    gap: 8px;
    min-height: 24px;
}

.lottery-item-header > div:first-child {
    min-width: 0;
    overflow: hidden;
}

.lottery-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.lottery-date {
    font-size: 9px;
    font-weight: 600;
    color: white;
    background: #333;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

.lottery-status {
    display: none;
}

.lottery-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

/* รอบที่ XX สำหรับหวยยี่กี */
.yikee-round-label {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #d4a574;
    margin-top: 8px;
    margin-bottom: -4px;
    padding: 4px 0;
}

.lottery-result-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    min-height: 60px;
}

.lottery-result-row.full-width {
    grid-column: 1 / -1;
    background: white;
    border: 2px solid #e9ecef;
}

.result-label {
    font-size: 11px;
    color: #d4a574;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
}

.result-number {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    font-family: 'Courier New', 'SF Mono', monospace;
    letter-spacing: 2px;
    text-align: center;
    line-height: 1.3;
}

.result-number.highlight {
    font-size: 22px;
    color: #1a1a1a;
}

.result-number.pending {
    color: #999;
    opacity: 0.6;
    font-size: 16px;
}

/* Special styles for different lottery types */
.lottery-item.government {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.lottery-item.stock {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.lottery-item.foreign {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.lottery-item.yingpong {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
}

.lottery-item.yingpong .lottery-name {
    color: #c2185b;
}

/* หวยยี่กี - สีทองสว่าง */
.lottery-item.yikee {
    background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
    border: 2px solid #ffc107;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.lottery-item.yikee .lottery-name {
    color: #f57f17;
    font-weight: 700;
}

.lottery-item.yikee .lottery-date {
    background: #f57f17;
}

.lottery-item.yikee:hover {
    box-shadow: 0 6px 16px rgba(255, 193, 7, 0.4);
    transform: translateY(-2px);
}

/* หวยเกษียณ - สีแดงพิเศษ */
.lottery-item.retirement {
    background: linear-gradient(135deg, #ffe6e6 0%, #ffffff 100%);
    border: 2px solid #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.lottery-item.retirement .lottery-name {
    color: #c0392b;
    font-weight: 700;
}

.lottery-item.retirement:hover {
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.3);
    transform: translateY(-2px);
}

/* ข้อความพิเศษในหวยเกษียณ */
.retirement-message {
    width: 100%;
    text-align: center;
    padding: 30px 20px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: #2c3e50;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* Rounds display for special lotteries */
.lottery-rounds {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.lottery-round-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.6);
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid rgba(0,0,0,0.05);
}

.round-number {
    font-weight: 600;
    color: #d4a574;
    font-size: 13px;
}

.round-result {
    font-weight: 700;
    color: #1a1a1a;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 1px;
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 12px;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.auto-refresh-indicator.active {
    display: flex;
}

.auto-refresh-indicator .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lottery-results-container {
        padding: 5px;
    }
    
    .lottery-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .lottery-item {
        padding: 12px;
        max-width: 100%;
    }
    
    .lottery-item-header {
        gap: 6px;
        min-height: 22px;
    }
    
    .lottery-name {
        font-size: 12px;
        gap: 3px;
    }
    
    .lottery-date {
        font-size: 8px;
        padding: 2px 5px;
    }
    
    .result-label {
        font-size: 10px;
    }
    
    .result-number {
        font-size: 16px;
    }
    
    .result-number.highlight {
        font-size: 20px;
    }
    
    .lottery-result-row {
        padding: 8px 4px;
        min-height: 50px;
    }
    
    .retirement-message {
        width: 100%;
        font-size: 16px;
        padding: 25px 15px;
        min-height: 70px;
    }
}

@media (max-width: 480px) {
    .lottery-results-container {
        max-width: 100%;
        padding: 4px;
    }
    
    .lottery-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .lottery-item {
        padding: 10px 8px;
        border-radius: 10px;
        max-width: 100%;
    }
    
    .lottery-item-header {
        gap: 4px;
        margin-bottom: 10px;
        min-height: 20px;
    }
    
    .lottery-name {
        font-size: 10.5px;
        gap: 2px;
    }
    
    .lottery-date {
        font-size: 7px;
        padding: 2px 4px;
    }
    
    .result-label {
        font-size: 9px;
    }
    
    .result-number {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    .result-number.highlight {
        font-size: 18px;
    }
    
    .lottery-result-row {
        padding: 8px 4px;
        min-height: 48px;
    }
    
    .retirement-message {
        width: 100%;
        font-size: 14px;
        padding: 20px 12px;
        min-height: 60px;
    }
}

@media (min-width: 769px) {
    .lottery-results-container {
        max-width: 1400px;
        padding: 8px;
    }
    
    .lottery-items {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .lottery-item {
        padding: 16px;
        max-width: 100%;
    }
    
    .lottery-name {
        font-size: 15px;
    }
    
    .lottery-date {
        font-size: 10px;
    }
    
    .result-number {
        font-size: 20px;
    }
    
    .result-number.highlight {
        font-size: 24px;
    }
}

/* Animation for new results */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lottery-item.new-result {
    animation: fadeIn 0.5s ease;
}

/* Print styles */
@media print {
    .lottery-header,
    .auto-refresh-indicator,
    .lottery-last-update {
        display: none;
    }
    
    .lottery-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
