/* ==========================================================================
   Google Trends Live Stylesheet - Fullscreen Fluid Layout & Responsive Grid
   ========================================================================== */

:root {
    --bg-primary: #080c14;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --bg-card: rgba(15, 23, 42, 0.92);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(239, 68, 68, 0.45);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-green: #34d399;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(239, 68, 68, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* 100% FLUID FULL-WIDTH CONTAINER */
.app-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 32px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2));
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 6px 10px;
    border-radius: var(--radius-md);
}

.logo-text h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #fca5a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-actions select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Hero */
.trends-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.04));
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 8px;
    border-radius: 20px;
    margin-bottom: 6px;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px #ef4444; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.hero-left h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.hero-left p {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 800px;
    line-height: 1.4;
}

.hero-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-stat-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 120px;
}

.hero-stat-num {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #facc15;
    font-family: 'Space Grotesk', sans-serif;
}

.hero-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 8px;
    flex: 1;
    min-width: 240px;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    width: 100%;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select {
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

#filter-period {
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-weight: 600;
}

#filter-macro {
    border-color: rgba(250, 204, 21, 0.35);
    color: #facc15;
    font-weight: 600;
    max-width: 260px;
}

#filter-traffic {
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    font-weight: 600;
}

#filter-sort {
    border-color: rgba(52, 211, 153, 0.35);
    color: #34d399;
    font-weight: 600;
}

.toolbar-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

#showing-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.quick-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #facc15;
    font-weight: 600;
    cursor: pointer;
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.25);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.15s;
}

.quick-toggle:hover {
    background: rgba(250, 204, 21, 0.15);
}

.quick-toggle input {
    cursor: pointer;
}

/* Trends Grid (Responsive Fluid Width) */
.trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    width: 100%;
}

.trend-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.22s ease;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    position: relative;
}

.trend-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.trend-card.elite-faceless {
    border-color: rgba(250, 204, 21, 0.35);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(250, 204, 21, 0.03));
}

.card-top-badges {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.macro-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 2px 7px;
    border-radius: 4px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpm-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 800;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.trend-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.trend-traffic-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.trend-traffic-badge.mega {
    color: #facc15;
    background: rgba(250, 204, 21, 0.15);
    border-color: rgba(250, 204, 21, 0.35);
}

.trend-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-top: 4px;
    text-transform: capitalize;
    line-height: 1.3;
}

/* Queries Chips */
.queries-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}

.query-chip {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Card Actions */
.trend-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}

.btn-ai-hook {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: #fff;
    border: none;
    font-weight: 700;
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
}

.btn-ai-hook:hover {
    opacity: 0.92;
    transform: scale(1.02);
}

.btn-icon-link {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 9px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
}

.btn-icon-link:hover {
    background: var(--bg-tertiary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Pagination Bar */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.page-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: rgba(255, 255, 255, 0.2);
}

.page-btn.active {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    color: #fff;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #fff;
}

/* Detail Modal Sections */
.detail-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.detail-stat-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
}

.detail-stat-val {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    display: block;
    margin-bottom: 2px;
}

.detail-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-csv-preview {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #a5f3fc;
    word-break: break-all;
    margin: 12px 0;
}

.blueprint-box {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.blueprint-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.35;
}

.blueprint-hook {
    font-size: 13px;
    color: #fca5a5;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid #ef4444;
    margin-bottom: 12px;
    font-style: italic;
    line-height: 1.4;
}

.outline-list {
    list-style: none;
    margin: 12px 0;
}

.outline-list li {
    font-size: 13px;
    color: var(--text-primary);
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag-pill {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
    color: var(--text-secondary);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
