/* styles.css - Estilos para PublicMdDocs */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    display: grid;
    gap: 2rem;
}

/* Upload Section */
.upload-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.upload-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
}

/* File Input */
.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.file-icon {
    font-size: 1.5rem;
}

/* Text Input */
.text-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-tertiary:hover {
    background: #dc2626;
}

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

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

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

.btn-link:hover {
    background: #475569;
}

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

.btn-icon {
    font-size: 1.2rem;
}

/* Status Messages */
.status-message {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: none;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Documents Section */
.documents-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.documents-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Document Card */
.document-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

.document-info {
    flex: 1;
}

.document-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.document-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

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

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    font-size: 0.9rem;
}

/* Error Message */
.error-message {
    padding: 1rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== VIEWER STYLES ========== */

.viewer-body {
    background: var(--card-bg);
}

.viewer-container {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.viewer-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.viewer-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.viewer-actions {
    display: flex;
    gap: 0.5rem;
}

.viewer-content {
    flex: 1;
    padding: 2rem;
}

/* Markdown Content Styling */
.markdown-body {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-body h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-body h3 { font-size: 1.25rem; }

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body code {
    background: var(--bg-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-body ul,
.markdown-body ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

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

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-color);
    font-weight: 600;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.viewer-footer {
    text-align: center;
    padding: 1rem;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Status Notification (nueva notificación flotante) */
.status-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.status-notification.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .document-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .document-actions {
        width: 100%;
    }

    .document-actions .btn {
        flex: 1;
    }

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

    .viewer-actions {
        width: 100%;
        justify-content: stretch;
    }

    .viewer-actions .btn {
        flex: 1;
    }

    .viewer-content {
        padding: 1rem;
    }
}
