/**
 * AEO Generator - Main Stylesheet
 */

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a87;
    --accent: #f0b429;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0ea5e9;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Navigation */
.main-nav {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 60px;
}

.nav-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-aeo {
    color: var(--accent);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-generator {
    color: #fff;
    font-size: 24px;
    font-weight: 300;
    margin-left: 6px;
}

.nav-menu {
    display: flex;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent);
    color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
}

.nav-icon svg {
    stroke: #fff;
}

.nav-item.active .nav-icon svg {
    stroke: var(--primary);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    margin-left: 4px;
}

.nav-item.active .nav-badge {
    background: var(--primary);
    color: #fff;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 20px;
    transition: all 0.15s ease;
}

.back-link:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* Article List */
.article-list {
    display: flex;
    flex-direction: column;
}

.article-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-200);
}

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

.article-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.article-title {
    font-weight: 500;
    color: var(--gray-900);
}

.article-title:hover {
    color: var(--primary);
}

.article-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.separator {
    margin: 0 4px;
}

/* Schedule List */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.schedule-date {
    background: #dbeafe;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    min-width: 50px;
}

.date-day {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.date-month {
    display: block;
    font-size: 11px;
    color: var(--primary-light);
    text-transform: uppercase;
}

.schedule-info {
    flex: 1;
}

.schedule-title {
    font-weight: 500;
    color: var(--gray-900);
}

.schedule-meta {
    font-size: 12px;
    color: var(--gray-500);
}

/* Property List/Grid */
.property-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.property-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 6px;
}

.property-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.property-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
}

.property-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.property-card .property-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.property-logo-lg {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
}

.property-logo-placeholder-lg {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.property-details {
    margin: 12px 0;
    font-size: 13px;
}

.detail-item {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.detail-label {
    color: var(--gray-500);
}

.property-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-draft { background: var(--gray-200); color: var(--gray-600); }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-scheduled { background: #e0e7ff; color: #3730a3; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-failed { background: #fee2e2; color: #dc2626; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: var(--gray-200); color: var(--gray-600); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45, 90, 135, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.form-required {
    color: var(--danger);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.filter-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tbody tr:hover {
    background: var(--gray-50);
}

.article-title-link {
    font-weight: 500;
    color: var(--gray-900);
}

.article-title-link:hover {
    color: var(--primary);
}

/* Utility Classes */
.text-muted {
    color: var(--gray-500);
}

.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state p {
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,0.1);
        flex-wrap: wrap;
    }

    .nav-label {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-header-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
    }
}

/* =====================================================
   PERFORMANCE PAGE - UI IMPROVEMENTS (2026-01-18)
   ===================================================== */

/* Enhanced Tab Navigation - Pill Style */
.performance-tabs-enhanced {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
    flex-wrap: wrap;
}

.performance-tabs-enhanced .tab-link {
    padding: 10px 20px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.performance-tabs-enhanced .tab-link:hover {
    color: var(--gray-800);
    background: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

.performance-tabs-enhanced .tab-link.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* Collapsible Section Styles */
.collapsible-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.section-header:hover {
    background: var(--gray-50);
}

.section-header.collapsed {
    border-radius: 8px;
}

.section-header h2,
.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-meta {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: normal;
}

.collapse-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    transition: transform 0.2s ease;
}

.section-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: white;
    padding: 16px;
    transition: all 0.3s ease;
}

.section-content.collapsed {
    display: none;
}

/* URL Truncation with Tooltip */
.url-cell {
    max-width: 280px;
    position: relative;
}

.url-cell .url-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--primary-light);
    font-size: 13px;
}

.url-cell .url-text:hover {
    color: var(--primary);
}

.url-cell .url-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: var(--gray-900);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.url-cell .url-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 12px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--gray-900);
}

.url-cell:hover .url-tooltip {
    display: block;
}

/* Path-only display for URLs */
.url-path {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    color: var(--gray-700);
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Section Dividers */
.section-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 32px 0;
}

.section-divider-with-label {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
}

.section-divider-with-label::before,
.section-divider-with-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.section-divider-with-label span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
}

/* Improved Stat Cards for Performance */
.stat-card-enhanced {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.stat-card-enhanced:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card-enhanced .stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.stat-card-enhanced .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-card-enhanced .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 4px;
}

.stat-card-enhanced .stat-change.positive {
    color: #166534;
    background: #dcfce7;
}

.stat-card-enhanced .stat-change.negative {
    color: #dc2626;
    background: #fee2e2;
}

.stat-card-enhanced .stat-change.neutral {
    color: var(--gray-500);
    background: var(--gray-100);
}

/* Mobile improvements for Performance page */
@media (max-width: 768px) {
    .performance-tabs-enhanced {
        width: 100%;
        justify-content: center;
    }

    .performance-tabs-enhanced .tab-link {
        padding: 8px 16px;
        font-size: 13px;
    }

    .section-header h2,
    .section-header h3 {
        font-size: 14px;
    }

    .url-cell {
        max-width: 180px;
    }

    .url-cell .url-tooltip {
        max-width: 280px;
        left: -20px;
    }
}
