/* Thai Lottery Widget for WordPress Elementor */
/* Enhanced Red-Dark Theme with Modern Design */
.thai-lottery-container {
    --tl-bg:           #0a0a0a;
    --tl-card-bg:      rgba(139, 0, 0, 0.15);
    --tl-card-bg-hover:rgba(139, 0, 0, 0.25);
    --tl-text-base:    #f5f5f5;
    --tl-text-muted:   #b0b0b0;
    --tl-accent-red:   #dc2626;
    --tl-accent-hover: #b91c1c;
    --tl-accent-light: #ef4444;
    --tl-radius:       16px;
    --tl-radius-sm:    8px;
    --tl-gap:          1.5rem;
    --tl-transition:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --tl-success:      #10b981;
    --tl-warning:      #f59e0b;
    --tl-danger:       #ef4444;
    --tl-shadow:       0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --tl-shadow-lg:    0 25px 50px -12px rgba(139, 0, 0, 0.4);
    --tl-border:       rgba(139, 0, 0, 0.3);
    --tl-border-light: rgba(139, 0, 0, 0.2);
  }
  
  .thai-lottery-container * {
    box-sizing: border-box;
  }
  
  .thai-lottery-container {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 100%);
    color: var(--tl-text-base);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    border-radius: var(--tl-radius);
    overflow: hidden;
    position: relative;
  }
  
  .thai-lottery-wrapper {
    display: grid;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
  }
  
  .thai-lottery-card {
    background: var(--tl-card-bg);
    border-radius: var(--tl-radius);
    backdrop-filter: blur(20px);
    padding: 1.5rem;
    border: 1px solid var(--tl-border);
    box-shadow: var(--tl-shadow);
    transition: all var(--tl-transition), transform 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .thai-lottery-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(220, 38, 38, 0.05) 100%);
    opacity: 0;
    transition: opacity var(--tl-transition);
    pointer-events: none;
  }

  .thai-lottery-card:hover {
    background: var(--tl-card-bg-hover);
    border-color: var(--tl-accent-red);
    box-shadow: var(--tl-shadow-lg);
    transform: translateY(-4px);
  }

  .thai-lottery-card:hover::before {
    opacity: 1;
  }
  
  /* Primary Results */
  .thai-lottery-card.thai-lottery-primary {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(139, 0, 0, 0.3) 100%);
    border: 1px solid var(--tl-accent-red);
    box-shadow: var(--tl-shadow-lg), inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
  }

  .thai-lottery-card.thai-lottery-primary::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--tl-accent-red), var(--tl-accent-light), var(--tl-accent-red));
    border-radius: var(--tl-radius);
    z-index: -1;
    opacity: 0.3;
  }
  
  .thai-lottery-primary .thai-lottery-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tl-text-base);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .thai-lottery-primary .thai-lottery-draw-date {
    font-size: 0.9rem;
    color: var(--tl-text-muted);
    margin: 0;
    font-weight: 500;
    opacity: 0.9;
  }

  .thai-lottery-primary-number {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--tl-text-base);
    margin: 0.8rem 0;
    text-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    letter-spacing: 0.02em;
    position: relative;
    display: inline-block;
  }

  .thai-lottery-primary-number::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110%;
    height: 110%;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.1) 0%, transparent 70%);
    z-index: -1;
  }
  
  .thai-lottery-label {
    font-size: 1rem;
    color: var(--tl-text-muted);
    margin: 0.25rem 0;
  }
  
  .thai-lottery-sub-prizes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
  }

  .thai-lottery-sub-prize {
    background: rgba(0,0,0,0.3);
    padding: 0.8rem;
    border-radius: var(--tl-radius-sm);
    border: 1px solid var(--tl-border-light);
    transition: all var(--tl-transition);
  }

  .thai-lottery-sub-prize:hover {
    background: rgba(0,0,0,0.4);
    border-color: var(--tl-accent-red);
    transform: translateY(-1px);
  }

  .thai-lottery-sub-prize .thai-lottery-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--tl-text-base);
    margin: 0 0 0.3rem 0;
    letter-spacing: 0.02em;
  }
  
  .thai-lottery-sub-prize .thai-lottery-num .thai-lottery-separator {
    user-select: none;
  }
  
  .thai-lottery-sub-prize .thai-lottery-label {
    font-size: 0.8rem;
    color: var(--tl-text-muted);
    margin: 0;
  }
  
  .thai-lottery-sub-prize:last-child {
    grid-column: 1 / -1;
  }
  
  .thai-lottery-btn-more {
    margin-top: auto;
    padding: 0.75rem 1.5rem;
    background: var(--tl-accent-red);
    border: none;
    border-radius: var(--tl-radius);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--tl-transition), opacity var(--tl-transition);
    font-family: inherit;
    font-size: 1rem;
  }
  
  .thai-lottery-btn-more:hover {
    background: var(--tl-accent-hover);
    opacity: 0.9;
  }
  
  /* Search & History */
  .thai-lottery-card.thai-lottery-search {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .thai-lottery-search .thai-lottery-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tl-text-base);
    margin: 0;
  }

  .thai-lottery-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: stretch;
  }
  
  .thai-lottery-controls input {
    flex: 2 1 140px;
    padding: 0.8rem 1rem;
    border-radius: var(--tl-radius-sm);
    border: 1px solid var(--tl-border);
    background: rgba(255,255,255,0.08);
    color: var(--tl-text-base);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--tl-transition);
    backdrop-filter: blur(10px);
    min-width: 0;
  }

  .thai-lottery-controls input:focus {
    outline: none;
    border-color: var(--tl-accent-red);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  }
  
  .thai-lottery-controls input::placeholder {
    color: var(--tl-text-muted);
  }
  
  /* Modern Select Styling */
  .thai-lottery-controls select {
    flex: 1 1 140px;
    min-width: 140px;
    max-width: 200px;
    padding: 0.8rem 2rem;
    padding-right: 2.5rem;
    border-radius: var(--tl-radius-sm);
    border: 1px solid var(--tl-border);
    background: rgba(255,255,255,0.08) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23dc2626' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E") no-repeat calc(100% - 1rem) center;
    color: var(--tl-text-base);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--tl-transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    backdrop-filter: blur(10px);
  }
  
  .thai-lottery-controls select:hover {
    border-color: var(--tl-accent-red);
  }

  .thai-lottery-controls select:focus {
    outline: none;
    border-color: var(--tl-accent-red);
    background-color: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  }
  
  .thai-lottery-controls select option {
    background: #1a1a1a;
    color: var(--tl-text-base);
    padding: 0.5rem;
  }
  
  .thai-lottery-controls button {
    flex: 1 1 auto;
    padding: 0.8rem 1.2rem;
    border-radius: var(--tl-radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--tl-accent-red) 0%, var(--tl-accent-hover) 100%);
    color: #ffffff;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--tl-transition), transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 100px;
  }

  .thai-lottery-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
  }

  .thai-lottery-controls button:hover {
    background: linear-gradient(135deg, var(--tl-accent-light) 0%, var(--tl-accent-red) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
  }

  .thai-lottery-controls button:hover::before {
    left: 100%;
  }
  
  .thai-lottery-controls button:disabled {
    background: var(--tl-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
  }
  
  /* Loading */
  .thai-lottery-loading {
    text-align: center;
    padding: 2rem;
    color: var(--tl-text-muted);
    margin: 0;
  }
  
  /* Check Result */
  .thai-lottery-check-result {
    padding: 1rem;
    border-radius: var(--tl-radius);
    margin-top: 1rem;
    font-weight: 600;
    text-align: center;
  }
  
  .thai-lottery-check-result.thai-lottery-win {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid var(--tl-success);
    color: var(--tl-success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  }

  .thai-lottery-check-result.thai-lottery-no-win {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 1px solid var(--tl-danger);
    color: var(--tl-danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
  }

  .thai-lottery-check-result.thai-lottery-error {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 1px solid var(--tl-warning);
    color: var(--tl-warning);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
  }
  
  /* Prize Details Modal */
  .thai-lottery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 999999;
    backdrop-filter: blur(5px);
  }
  
  .thai-lottery-modal.thai-lottery-show {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .thai-lottery-modal-content {
    background: var(--tl-card-bg);
    padding: 1rem;
    border-radius: var(--tl-radius);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
  
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255,255,255,0.2) transparent; /* Firefox */
  }
  
  /* Scrollbar for WebKit (Chrome, Edge, Safari) */
  .thai-lottery-modal-content::-webkit-scrollbar {
    width: 8px;
  }
  
  .thai-lottery-modal-content::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .thai-lottery-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    transition: background 0.3s;
  }
  
  .thai-lottery-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
  }
  
  .thai-lottery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
  }
  
  .thai-lottery-modal-header h2 {
    color: var(--tl-text-base);
    margin: 0;
    font-size: 1.5rem;
  }
  
  .thai-lottery-close-btn {
    background: rgba(220, 53, 69, 0.1); /* สีแดงโปร่ง */
    border: 1px solid rgba(220, 53, 69, 0.25);
    color: #dc3545; /* สีแดงหลัก */
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
  
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
  
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    transition: all 0.2s ease-in-out;
  }
  
  .thai-lottery-close-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    transform: scale(1.05);
  }
  
  .thai-lottery-close-btn:active {
    background: rgba(220, 53, 69, 0.3);
    transform: scale(0.95);
  }
  
  
  .thai-lottery-prize-section {
    margin-bottom: 1.5rem;
  }
  
  .thai-lottery-prize-section h3 {
    color: var(--tl-text-base);
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
  }
  
  .thai-lottery-prize-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .thai-lottery-prize-number {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--tl-radius);
    font-weight: 600;
    color: var(--tl-text-base);
  }
  
  /* History Styling */
  .thai-lottery-history {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .thai-lottery-history-item {
    background: rgba(139, 0, 0, 0.15);
    border-radius: var(--tl-radius-sm);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--tl-border-light);
    transition: all var(--tl-transition);
  }

  .thai-lottery-history-item:hover {
    background: rgba(139, 0, 0, 0.25);
    border-color: var(--tl-accent-red);
    transform: translateY(-1px);
  }

  .thai-lottery-history-item .thai-lottery-date-header {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.3) 0%, rgba(139, 0, 0, 0.2) 100%);
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tl-text-base);
    border-bottom: 1px solid var(--tl-border);
    margin: 0;
    letter-spacing: 0.02em;
  }

  .thai-lottery-history-item .thai-lottery-content {
    padding: 0.6rem;
  }
  
  .thai-lottery-prizes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .thai-lottery-prize-item .thai-lottery-label {
    font-size: 0.75rem;
    color: var(--tl-text-muted);
    margin: 0;
  }
  
  .thai-lottery-prize-item .thai-lottery-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tl-text-base);
    margin: 0;
  }
  
  .thai-lottery-prize-item .thai-lottery-value.thai-lottery-primary-prize {
    font-size: 1.5rem;
    font-weight: 700;
  }
  
  /* Responsive Design */
  @media (min-width: 768px) and (max-width: 1024px) {
    .thai-lottery-wrapper {
      grid-template-columns: 1fr;
      max-width: 800px;
      gap: 1.5rem;
    }
    
    .thai-lottery-card {
      padding: 2.5rem;
    }
    
    .thai-lottery-primary-number {
      font-size: 4rem;
    }
    
    .thai-lottery-sub-prizes {
      grid-template-columns: repeat(2, 1fr);
      gap: 1.5rem;
    }
    
    .thai-lottery-history {
      grid-template-columns: repeat(2, 1fr);
      gap: 1.5rem;
    }
    
    .thai-lottery-controls {
      display: grid;
      grid-template-columns: 1fr 1fr auto;
      gap: 1rem;
    }
    
    .thai-lottery-modal-content {
      max-width: 600px;
      padding: 1.5rem;
    }
  }
  
  @media (min-width: 768px) and (max-width: 834px) and (orientation: portrait) {
    .thai-lottery-wrapper {
      max-width: 700px;
    }
    
    .thai-lottery-history {
      grid-template-columns: 1fr;
    }
  }
  
  @media (max-width: 767px) {
    .thai-lottery-wrapper {
      grid-template-columns: 1fr;
      padding: 0.5rem;
      gap: 1rem;
    }
    
    .thai-lottery-card {
      padding: 1.5rem;
    }
    
    .thai-lottery-primary-number {
      font-size: 2.5rem;
    }
    
    .thai-lottery-sub-prizes {
      grid-template-columns: repeat(2, 1fr);
      gap: 1rem;
    }
  
    .thai-lottery-sub-prize:last-child {
      grid-column: 1 / -1;
    }
    
    .thai-lottery-history {
      grid-template-columns: 1fr;
    }
    
    .thai-lottery-controls {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    
    .thai-lottery-controls input,
    .thai-lottery-controls select,
    .thai-lottery-controls button {
      flex: 0 0 auto;
      width: 100%;
      min-width: auto;
      max-width: none;
    }
    
    .thai-lottery-modal-content {
      margin: 1rem;
      padding: 1.5rem;
    }
  }
  
  /* WordPress Theme Compatibility */
  .thai-lottery-container p,
  .thai-lottery-container h1,
  .thai-lottery-container h2,
  .thai-lottery-container h4,
  .thai-lottery-container h5,
  .thai-lottery-container h6 {
    margin: 0;
  }
  
  .thai-lottery-container a {
    text-decoration: none;
    color: inherit;
  }
  
  /* Elementor Widget Specific */
  .elementor-widget-html .thai-lottery-container {
    margin: 0;
  }
  
  .elementor-widget .thai-lottery-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  } 