/* Variables */
:root {
    --primary-color: #dd4b39;
    --primary-hover: #c23321;
    --secondary-color: #4285f4;
    --text-color: #222;
    --text-secondary: #666;
    --border-color: #ddd;
    --bg-primary: #fff;
    --bg-secondary: #f5f5f5;
    --bg-hover: #f9f9f9;
    --bg-selected: #e8f0fe;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background: var(--bg-secondary);
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

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

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.login-container {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.login-header p {
    color: var(--text-secondary);
}

.auth-form h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(221, 75, 57, 0.1);
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.error-message.show {
    display: block;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

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

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

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

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-color);
}

.btn-icon:hover {
    background: var(--bg-hover);
}

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

.btn .icon {
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.user-info {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    font-size: 14px;
}

.user-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

.dropdown-item {
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

/* Main Content */
.main-content {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Feed List Pane */
.feed-list-pane {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.feed-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.feed-list-header h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.view-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.view-btn {
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.view-btn:hover {
    background: var(--bg-hover);
}

.view-btn.active {
    background: var(--bg-selected);
    font-weight: 500;
    color: var(--secondary-color);
}

.view-btn .count {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

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

.feed-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.feed-item {
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.feed-item:hover {
    background: var(--bg-hover);
}

.feed-item.active {
    background: var(--bg-selected);
    font-weight: 500;
}

.feed-info {
    flex: 1;
    min-width: 0;
}

.feed-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-unread {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Article List Pane */
.article-list-pane {
    width: 400px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.article-list-header {
    padding: 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-list-header h2 {
    font-size: 18px;
}

.article-list-controls select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

.article-list {
    flex: 1;
    overflow-y: auto;
}

.article-item {
    background: var(--bg-primary);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.article-item:hover {
    background: var(--bg-hover);
}

.article-item.active {
    background: var(--bg-selected);
    border-left: 3px solid var(--secondary-color);
    padding-left: 13px;
}

.article-item.read {
    opacity: 0.6;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.article-title {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.article-item.read .article-title {
    font-weight: 400;
}

.article-star {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
}

.article-star.starred {
    color: #ffc107;
}

.article-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

.article-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Content Pane */
.article-content-pane {
    flex: 1;
    background: var(--bg-primary);
    overflow-y: auto;
}

#article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
}

.article-full-header {
    margin-bottom: 24px;
}

.article-full-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
}

.article-full-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.article-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.article-full-content {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-color);
}

.article-full-content p {
    margin-bottom: 16px;
}

.article-full-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
}

.article-full-content a {
    color: var(--secondary-color);
    text-decoration: none;
}

.article-full-content a:hover {
    text-decoration: underline;
}

.article-full-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-full-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.article-full-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 20px 0;
}

/* Empty State */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-color);
}

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

.keyboard-shortcuts {
    max-width: 400px;
    margin: 30px auto 0;
    text-align: left;
}

.keyboard-shortcuts h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-color);
}

.keyboard-shortcuts ul {
    list-style: none;
}

.keyboard-shortcuts li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

kbd {
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 13px;
    min-width: 30px;
    text-align: center;
    display: inline-block;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

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

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

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

.toast {
    background: var(--text-color);
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.info {
    background: var(--secondary-color);
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive */
@media (max-width: 1024px) {
    .feed-list-pane {
        width: 240px;
    }
    
    .article-list-pane {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .feed-list-pane,
    .article-list-pane {
        width: 100%;
        height: 33.33%;
    }
    
    .article-content-pane {
        display: none;
    }
    
    .article-content-pane.show {
        display: block;
        height: 100%;
    }
}
