enhanced-styles.css

9.01 KB
02/07/2025 02:09
CSS
enhanced-styles.css
/* 🎨 Enhanced Styles สำหรับแดชบอร์ดแนวโน้มการเมืองไทย */
/* ===== NOTIFICATION SYSTEM ===== */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 300px;
}
.notification.success {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border-left: 4px solid #1e8449;
}
.notification.error {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-left: 4px solid #a93226;
}
.notification.warning {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  border-left: 4px solid #d68910;
}
.notification.info {
  background: linear-gradient(135deg, #3498db, #2980b9);
  border-left: 4px solid #21618c;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
/* ===== LOADING INDICATORS ===== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.loading-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
/* ===== ENHANCED CHART CONTAINERS ===== */
.chart-container {
  position: relative;
  transition: all 0.3s ease;
}
.chart-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}
.chart-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.chart-container:hover .chart-actions {
  opacity: 1;
}
.chart-action-btn {
  background: rgba(52, 152, 219, 0.9);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.chart-action-btn:hover {
  background: rgba(52, 152, 219, 1);
  transform: scale(1.05);
}
/* ===== ENHANCED FILTERS ===== */
.advanced-filters {
  background: #2c3e50;
  padding: 25px 30px;
  margin-top: 20px;
  border-radius: 10px;
  display: none;
}
.advanced-filters.active {
  display: block;
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-group label {
  color: #ecf0f1;
  font-weight: 500;
  font-size: 0.9rem;
}
.filter-group select,
.filter-group input {
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: white;
  color: #2c3e50;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}
.toggle-filters-btn {
  background: #34495e;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-top: 10px;
}
.toggle-filters-btn:hover {
  background: #2c3e50;
  transform: translateY(-1px);
}
/* ===== ENHANCED STAT CARDS ===== */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::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;
}
.stat-card:hover::before {
  left: 100%;
}
.stat-card .trend-indicator {
  position: relative;
  z-index: 2;
}
.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2c3e50, #3498db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* ===== DATA SOURCE BADGES ===== */
.data-source-badge {
  display: inline-block;
  padding: 4px 8px;
  background: #ecf0f1;
  color: #7f8c8d;
  border-radius: 12px;
  font-size: 0.75rem;
  margin: 2px;
  transition: all 0.2s ease;
}
.data-source-badge:hover {
  background: #3498db;
  color: white;
  transform: scale(1.05);
}
.data-source-badge.verified {
  background: #2ecc71;
  color: white;
}
.data-source-badge.pending {
  background: #f39c12;
  color: white;
}
/* ===== EXPORT BUTTONS ===== */
.export-section {
  background: #f8f9fa;
  padding: 20px 30px;
  border-radius: 10px;
  margin: 20px 0;
  text-align: center;
}
.export-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}
.export-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}
.export-btn.pdf {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}
.export-btn.excel {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}
.export-btn.csv {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
}
/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 768px) {
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  .filter-row {
    grid-template-columns: 1fr;
  }
  .export-buttons {
    flex-direction: column;
    align-items: center;
  }
  .chart-actions {
    position: static;
    opacity: 1;
    justify-content: center;
    margin-top: 10px;
  }
  .stat-card .stat-value {
    font-size: 2rem;
  }
}
/* ===== ANIMATION ENHANCEMENTS ===== */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}
.stat-card.updated {
  animation: pulse 0.5s ease-in-out;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.chart-container {
  animation: fadeInUp 0.6s ease-out;
}
/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .container {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
  }
  .stat-card {
    background: #34495e;
    color: #ecf0f1;
  }
  .chart-container {
    background: #34495e;
    color: #ecf0f1;
  }
  .filter-group select,
  .filter-group input {
    background: #2c3e50;
    color: #ecf0f1;
  }
}
/* ===== PRINT STYLES ===== */
@media print {
  .notification,
  .chart-actions,
  .export-section,
  .filter-section {
    display: none !important;
  }
  .container {
    box-shadow: none;
    border-radius: 0;
  }
  .stat-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .chart-container {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}
/* ===== FOCUS INDICATORS ===== */
button:focus,
select:focus,
input:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}
/* ===== TOOLTIP STYLES ===== */
.tooltip {
  position: relative;
  display: inline-block;
}
.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: #2c3e50;
  color: white;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
/* ===== PROGRESS BARS ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #ecf0f1;
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 4px;
  transition: width 0.3s ease;
}
/* ===== BADGE STYLES ===== */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.success {
  background: #2ecc71;
  color: white;
}
.badge.warning {
  background: #f39c12;
  color: white;
}
.badge.danger {
  background: #e74c3c;
  color: white;
}
.badge.info {
  background: #3498db;
  color: white;
}