/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #007AFF;
    --color-success: #34C759;
    --color-warning: #FF9500;
    --color-danger: #FF3B30;
    --color-info: #5856D6;
    --color-text: #1d1d1f;
    --color-text-secondary: #86868b;
    --color-bg: #ffffff;
    --color-bg-secondary: #f5f5f7;
    --color-bg-tertiary: #e8e8ed;
    --color-border: #d2d2d7;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Header */
.header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.8);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--color-bg-tertiary);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Navigation */
.nav {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-items {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    min-width: max-content;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-item svg {
    opacity: 0.6;
}

.nav-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.nav-item.active {
    background: var(--color-primary);
    color: white;
}

.nav-item.active svg {
    opacity: 1;
}

.badge {
    background: var(--color-danger);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-item.active .badge {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main {
    padding: 32px 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--color-text);
}

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

.stat-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 16px;
    align-items: center;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

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

/* Section */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
}

/* News List */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.news-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    cursor: pointer;
}

.news-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.news-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    flex: 1;
}

.news-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
}

.news-status.new,
.news-status.pending_moderation {
    background: #FFF3CD;
    color: #856404;
}

.news-status.approved {
    background: #D1ECF1;
    color: #0C5460;
}

.news-status.ready_to_publish {
    background: #D4EDDA;
    color: #155724;
}

.news-status.published {
    background: #D1F2EB;
    color: #0C5460;
}

.news-status.rejected {
    background: #F8D7DA;
    color: #721C24;
}

.news-status.on_hold {
    background: #E2E3E5;
    color: #383D41;
}

.news-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.news-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-summary {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

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

.btn-primary:hover {
    background: #0051D5;
}

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

.btn-success:hover {
    background: #28A745;
}

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

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

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

.btn-secondary:hover {
    background: var(--color-bg-tertiary);
}

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

.btn-warning:hover {
    background: #FF8C00;
}

/* Sources Grid */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.source-card {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.source-type {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.source-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.source-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.modal-section-content {
    font-size: 15px;
    color: var(--color-text);
    line-height: 1.6;
}

.modal-section-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.modal-section-content a:hover {
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

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

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
}

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

.toast.error .toast-icon {
    color: var(--color-danger);
}

.toast.info .toast-icon {
    color: var(--color-primary);
}

.toast.warning .toast-icon {
    color: var(--color-warning);
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-bg-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--color-text-secondary);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 15px;
    color: var(--color-text-secondary);
}

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

    .view-title {
        font-size: 24px;
    }

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

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

    .news-actions {
        width: 100%;
    }

    .news-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .modal-content {
        max-width: 100%;
        border-radius: var(--radius-md);
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }
}
