/* Import Google Font - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Base styles */
:root {
    --primary-color: #0D5C75;
    --primary-hover: #094556;
    --primary-light: #1A7FA0;
    --accent-color: #FF6B35;
    --accent-hover: #E85A28;
    --secondary-color: #5B6B7A;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --background: #F5F7FA;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text-primary: #1A2633;
    --text-secondary: #5B6B7A;
    --border-color: #DDE3EA;
    --shadow-sm: 0 1px 2px rgba(13, 92, 117, 0.06);
    --shadow: 0 2px 8px rgba(13, 92, 117, 0.1), 0 1px 3px rgba(13, 92, 117, 0.06);
    --shadow-lg: 0 10px 30px rgba(13, 92, 117, 0.12), 0 4px 8px rgba(13, 92, 117, 0.08);
    --gradient-primary: linear-gradient(135deg, #0D5C75 0%, #1A7FA0 100%);
    --gradient-accent: linear-gradient(135deg, #FF6B35 0%, #FF8C61 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

h1 {
    font-size: 2.25rem;
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.25rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: var(--surface);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand a::before {
    content: "📊";
    font-size: 1.75rem;
    -webkit-text-fill-color: initial;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    font-weight: 500;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-color);
    background-color: rgba(13, 92, 117, 0.05);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.2s ease;
    transform: translateX(-50%);
}

.nav-links a:hover::after {
    width: 80%;
}

.nav-basket {
    position: relative;
}

.badge {
    background: var(--gradient-accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    margin-left: 0.375rem;
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.25);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Main content */
main {
    flex: 1;
    padding: 2rem 1rem;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background-color: #dcfce7;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.flash-error {
    background-color: #fee2e2;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.flash-warning {
    background-color: #fef3c7;
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.flash-info {
    background-color: #dbeafe;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
}

.flash-close:hover {
    opacity: 1;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 1rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/><circle cx="50" cy="50" r="30" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/><circle cx="50" cy="50" r="20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></svg>');
    background-size: 300px 300px;
    opacity: 0.4;
    pointer-events: none;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.35rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    font-weight: 400;
}

/* Sections */
section {
    margin-bottom: 2rem;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Steps */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.step {
    background: var(--surface);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
    border-top: 3px solid var(--primary-light);
}

.step:hover {
    box-shadow: var(--shadow-lg);
    border-top-color: var(--accent-color);
}

.step-number {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(13, 92, 117, 0.25);
}

.step h3 {
    margin-bottom: 0.5rem;
}

.step p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Status cards */
.status-cards {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.status-card {
    background: var(--surface);
    padding: 1.5rem 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.status-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.status-label {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(13, 92, 117, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #4A5866;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface);
}

.form-control:hover {
    border-color: var(--primary-light);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 92, 117, 0.1);
    background: white;
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border-top: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 0.75rem 0.75rem 0 0;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

/* Dataset cards */
.dataset-card {
    background: var(--surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border-left: 5px solid var(--primary-light);
    transition: all 0.3s ease;
    position: relative;
}

.dataset-card::after {
    content: '';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-light);
    opacity: 0.3;
}

.dataset-card:hover {
    box-shadow: var(--shadow-lg);
    border-left-color: var(--accent-color);
}

.dataset-card:hover::after {
    background: var(--accent-color);
    opacity: 1;
}

.dataset-card.selected {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, rgba(22, 163, 74, 0.03), transparent);
}

.dataset-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.dataset-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dataset-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.dataset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--background);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid;
    transition: all 0.2s ease;
}

.status-active {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: var(--success-color);
    border-color: #86efac;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.15);
}

.status-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--error-color);
    border-color: #fca5a5;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.15);
}

.status-pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: var(--warning-color);
    border-color: #fcd34d;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.15);
}

/* Email preview */
.email-preview {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.email-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.email-to, .email-subject {
    margin-bottom: 0.5rem;
}

.email-label {
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-block;
    width: 80px;
}

.email-body {
    font-family: monospace;
    white-space: pre-wrap;
    background: var(--background);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
}

.pagination a, .pagination span {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s ease;
    background: var(--surface);
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.pagination .active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.page-info {
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Filter sidebar */
.filters {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border-top: 3px solid var(--primary-color);
}

.filters h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Keywords and themes */
.dataset-keywords,
.dataset-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.keyword-tag {
    background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%);
    color: #075985;
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #7DD3FC;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    box-shadow: 0 2px 6px rgba(3, 105, 161, 0.2);
}

.keyword-more {
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    font-style: italic;
}

.theme-tag {
    background: linear-gradient(135deg, #FAE8FF 0%, #F3E8FF 100%);
    color: #86198F;
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #E9D5FF;
    transition: all 0.2s ease;
}

.theme-tag:hover {
    box-shadow: 0 2px 6px rgba(162, 28, 175, 0.2);
}

/* Dataset card in basket */
.dataset-card.in-basket {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, rgba(22, 163, 74, 0.05), transparent);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.1), var(--shadow);
}

.dataset-card.in-basket::after {
    background: var(--success-color);
    opacity: 1;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Detail page styles */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.detail-list dt {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-list dd {
    margin: 0;
}

.distribution-list {
    list-style: none;
    padding: 0;
}

.distribution-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.distribution-list li:last-child {
    border-bottom: none;
}

/* Page info in pagination - already defined above */

/* Contact groups (basket page) */
.contact-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.contact-group:last-child {
    border-bottom: none;
}

.contact-email {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.text-warning {
    color: var(--warning-color);
}

/* Form sections */
.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-section-title:first-child {
    margin-top: 0;
}

.required {
    color: var(--error-color);
}

/* Selected datasets summary */
.selected-datasets {
    background: var(--background);
    border-radius: 0.5rem;
    padding: 1rem;
}

.dataset-summary {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.dataset-summary:last-child {
    border-bottom: none;
}

.dataset-summary .dataset-meta {
    display: block;
    margin-top: 0.25rem;
}

/* Email preview card */
.email-preview-card {
    margin-bottom: 1.5rem;
}

.copy-btn {
    margin-left: auto;
}

/* Footer */
footer {
    background: var(--surface);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 3px solid var(--primary-color);
    margin-top: auto;
    box-shadow: 0 -2px 8px rgba(13, 92, 117, 0.05);
}

footer::before {
    content: '🔬';
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

/* Links */
a {
    color: var(--primary-color);
}

a:hover {
    color: var(--primary-hover);
}

/* Lists in intro section */
.intro ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.intro li {
    margin-bottom: 0.25rem;
}

/* Dataset title links */
.dataset-title a {
    color: var(--text-primary);
    text-decoration: none;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    background-color: var(--success-color);
    color: white;
}

.toast-error {
    background-color: var(--error-color);
    color: white;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in animation for page content */
main {
    animation: fadeInUp 0.5s ease-out;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(13, 92, 117, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Shimmer effect for loading cards */
.loading-card {
    background: linear-gradient(
        90deg,
        var(--surface) 0%,
        rgba(13, 92, 117, 0.03) 50%,
        var(--surface) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .status-cards {
        flex-direction: column;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .card-footer {
        flex-wrap: wrap;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .email-body {
        font-size: 0.75rem;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .detail-list dt {
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}
