/* Forex Factory DETAILED Data Scraper Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 12px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    text-align: center;
}

h1 {
    color: #1e3c72;
    margin-bottom: 6px;
    font-size: 1.8em;
}

h2 {
    color: #1e3c72;
    margin-bottom: 6px;
    font-size: 1.6em;
}

.subtitle {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 12px;
}

.version-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.75em;
    margin-bottom: 8px;
}

.last-update {
    background: #e8f4f8;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    color: #1e3c72;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 0.8em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.info-card h3 {
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 1em;
}

.info-card p {
    color: #666;
    font-size: 0.95em;
}

.buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: white;
    color: #1e3c72;
    border: 2px solid #1e3c72;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.code-block {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
}

.code-block code {
    color: #333;
    font-size: 14px;
}

.data-preview {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

th {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 6px 8px;
    text-align: center;
    position: sticky;
    top: 0;
    font-size: 0.75em;
    white-space: nowrap;
}

td {
    padding: 4px 6px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.75em;
    white-space: nowrap;
}

.link-column {
    width: 35px;
    text-align: center;
    padding: 4px !important;
}

.link-column a {
    color: #1e3c72;
    text-decoration: none;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.link-column a:hover {
    background-color: rgba(30, 60, 114, 0.1);
    transform: scale(1.1);
    cursor: pointer;
}

.link-column th {
    width: 35px;
}

.link-column img {
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.link-column a:hover img {
    opacity: 1;
}

tr:hover {
    background: #ecf3f9;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.filter-header h5 {
    margin: 0;
    flex-grow: 1;
}

.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 8px;
}

.filter-btn {
    background: #1e3c72;
    color: white;
    border: none;
    padding: 3px 8px;
    font-size: 0.7em;
    border-radius: 3px;
    cursor: pointer;
    min-width: 35px;
    transition: background-color 0.2s ease;
}

.filter-btn:hover {
    background: #2a5298;
}

.filter-btn:active {
    background: #164263;
}

.btn-clear-all {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 20px;
    font-size: 0.8em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    white-space: nowrap;
    width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-clear-all:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-clear-all:active {
    background: #a71e2a;
    transform: translateY(0);
}

.impact-high {
    background: #ff4444;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
    font-weight: bold;
}

.impact-medium {
    background: #ff9800;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
}

.impact-low {
    background: #4caf50;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.error {
    background: #fee;
    color: #c00;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
}

footer a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

.manual-scraping-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid #e9ecef;
}

.date-selection-container {
    background: #fff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #e1e5e9;
}

.date-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 12px;
}

.secondary-options {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 15px;
    margin-top: 12px;
}

.button-stack { 
    display: flex; 
    justify-content: center;
    gap: 12px; 
    margin-top: 10px; 
}

.quick-links { 
    background: #fff; 
    border: 1px solid #e9ecef; 
    border-radius: 6px; 
    padding: 10px; 
}

.quick-links h4 { 
    margin: 0 0 8px 0; 
    color: #1e3c72; 
    font-size: 0.8em; 
    font-weight: 600;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quick-links-column {
    display: flex;
    flex-direction: column;
}

.quick-links-column strong {
    font-size: 0.7em;
    color: #495057;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.quick-links-column a { 
    display: block; 
    margin: 2px 0; 
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-decoration: none; 
    font-size: 0.75em; 
    padding: 6px 8px;
    border-radius: 4px;
    text-align: center;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-links-column a:hover { 
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-decoration: none; 
}

/* Filter Panel Styles */
.filter-panel {
    background: #2c3e50;
    border: 1px solid #34495e;
    border-radius: 6px;
    padding: 10px;
    color: #ecf0f1;
}

.filter-panel h4 {
    margin: 0 0 8px 0;
    color: #ecf0f1;
    font-size: 0.8em;
    font-weight: 600;
}

.filter-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.filter-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 4px;
}

.filter-section h5 {
    color: #ecf0f1;
    margin: 0 0 6px 0;
    font-size: 0.7em;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-section h5 span {
    font-size: 0.65em;
    color: #95a5a6;
    font-weight: normal;
}

.filter-section h5 span a {
    color: #3498db;
    text-decoration: none;
    cursor: pointer;
}

.filter-section h5 span a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.filter-item {
    display: flex;
    align-items: center;
    margin: 3px 0;
    font-size: 0.7em;
}

.filter-item input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    transform: scale(0.8);
}

.filter-item label {
    cursor: pointer;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Event Filter Bar */
.event-filter-bar {
    background: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 10px;
    border-radius: 4px;
}

.event-filter-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.event-filter-container label {
    font-weight: 600;
    color: #495057;
    margin-right: 8px;
}

.event-filter-input {
    width: 300px;
    max-width: 100%;
    padding: 6px 8px;
    font-size: 0.85em;
    background: white;
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.event-filter-input:focus {
    outline: none;
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.event-filter-input::placeholder {
    color: #999;
}

.search-filter-btn {
    background: #667eea;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-filter-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.clear-filter-btn {
    background: #e53e3e;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-filter-btn:hover {
    background: #c53030;
}

.clear-filter-btn:not(.has-value) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Event Suggestions Dropdown */
.event-suggestions-dropdown {
    position: fixed;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    max-height: 250px;
    min-width: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 99999;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: left;
    padding: 0;
    margin: 0;
}

.suggestion-item {
    padding: 8px 12px;
    color: #333;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    pointer-events: auto;
    position: relative;
}

.suggestion-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    margin-top: 2px;
    padding-top: 10px;
}

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

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item strong {
    color: #667eea;
    font-weight: bold;
    text-align: left;
    pointer-events: none;
}

.impact-flag {
    width: 12px;
    height: 8px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.impact-flag.red { background: #e74c3c; }
.impact-flag.orange { background: #f39c12; }
.impact-flag.yellow { background: #f1c40f; }
.impact-flag.gray { background: #95a5a6; }


.manual-scraping-section h3 {
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.manual-scraping-section p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.date-inputs {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.input-group label {
    font-weight: 600;
    color: #1e3c72;
    font-size: 0.9em;
}

.input-group input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.3s;
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-load {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8em;
    width: 200px;
}

.btn-open-ff {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    width: 100%;
}

.btn-load:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.btn-open-ff:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.extra-fields {
    background: #e8f4f8;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.85em;
    color: #1e3c72;
}

.extra-fields strong {
    color: #2a5298;
}

/* Pagination Styles */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.btn-pagination {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

.btn-pagination:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-pagination:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-info {
    font-size: 0.9em;
    color: #1e3c72;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .filter-panel {
        min-width: auto;
        width: 100%;
        margin-top: 15px;
    }
    
    .manual-scrape-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-columns {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Selector Sections */
.selector-section {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
}

.selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.selector-header h4 {
  margin: 0;
  color: #1e3c72;
  font-size: 0.85em;
}

.selector-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.selector-bulk-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.btn-check-all {
  padding: 4px 12px;
  font-size: 0.75em;
  border: 1px solid #ddd;
  background: white;
  color: #333;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-check-all:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.selector-navigation button {
  padding: 3px 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.75em;
}

.selector-navigation span {
  min-width: 120px;
  text-align: center;
  font-weight: 600;
  color: #1e3c72;
  font-size: 0.8em;
}

/* Week Grid */
.week-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 250px;
  overflow-y: auto;
}

.week-item {
  display: flex;
  align-items: center;
  padding: 6px;
  background: white;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.week-item:hover {
  background: #f0f4ff;
}

.week-item input[type="checkbox"] {
  margin-right: 8px;
}

.week-item label {
  flex: 1;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.week-dates {
  font-weight: 500;
  color: #2c3e50;
  font-size: 0.75em;
}

.week-number {
  color: #7f8c8d;
  font-size: 0.7em;
}

.week-item.other-month {
  opacity: 0.6;
  background: #f8f9fa;
}

/* Month Grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.month-item {
  display: flex;
  align-items: center;
}

.month-item input[type="checkbox"] {
  margin-right: 6px;
}

.month-item label {
  cursor: pointer;
  color: #2c3e50;
  font-size: 0.75em;
}

/* Selected Display */
.selected-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  min-height: 24px;
}

.selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.7em;
}

.selected-badge .remove {
  cursor: pointer;
  font-weight: bold;
  margin-left: 3px;
}

.selected-badge .remove:hover {
  color: #ff6b6b;
}

/* Selector Actions */
.selector-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selector-actions span {
  font-size: 0.7em;
  color: #666;
}

.selector-actions button {
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #dc3545;
  color: #dc3545;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.65em;
}

.selector-actions button:hover {
  background: #dc3545;
  color: white;
}

/* Preview Header */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.btn-open-ff {
  padding: 6px 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.75em;
  white-space: nowrap;
  display: inline-block;
  min-width: auto;
  width: auto;
}

.btn-open-ff:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    header {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    .buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    button {
        width: 100%;
        justify-content: center;
    }
    
    .date-selection-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .secondary-options {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .button-stack {
        flex-direction: column;
    }
    
    .data-preview {
        padding: 12px;
    }
    
    th, td {
        padding: 3px 4px;
        font-size: 0.7em;
    }
    
    .month-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-columns {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}