/* ========================================
   TATIN - CREAR POST
   Estilos para la página de creación de posts
   ======================================== */

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
    min-height: calc(100vh - 200px);
}

.crear-post-wrapper {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(245, 248, 255, 0.9) 100%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(200, 220, 255, 0.6);
}

/* ==================== HEADER DE LA PÁGINA ==================== */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(33, 150, 243, 0.2);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2196F3;
    margin-bottom: 10px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.page-subtitle {
    color: #7F8C8D;
    font-size: 1rem;
}

/* ==================== FORMULARIO ==================== */
.form-crear-post {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-weight: 600;
    color: #2C3E50;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.required {
    color: #F44336;
}

/* ==================== INPUTS ==================== */
.form-input,
.form-select,
.form-textarea {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(150, 180, 220, 0.6);
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(248, 250, 255, 0.95) 100%);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 1rem;
    color: #2C3E50;
    transition: all 0.2s ease;
    width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #2196F3;
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.08),
        0 0 0 3px rgba(33, 150, 243, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 300px;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.6;
}

.input-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #7F8C8D;
}

.hint-text {
    font-style: italic;
}

/* ==================== EDITOR TOOLBAR ==================== */
.editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: linear-gradient(180deg,
        rgba(240, 245, 255, 0.9) 0%,
        rgba(230, 238, 255, 0.85) 100%);
    border: 1px solid rgba(150, 180, 220, 0.6);
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 8px 12px;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(245, 248, 255, 0.9) 100%);
    border: 1px solid rgba(200, 220, 255, 0.6);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #2C3E50;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: linear-gradient(180deg, #2196F3 0%, #1976D2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.toolbar-btn:active {
    transform: translateY(0);
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(150, 180, 220, 0.4);
    align-self: center;
}

/* ==================== PROTOCOLO ==================== */
.protocolo-box {
    background: linear-gradient(135deg,
        rgba(255, 243, 224, 0.9) 0%,
        rgba(255, 236, 179, 0.85) 100%);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
}

.protocolo-title {
    color: #F57C00;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.protocolo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.protocolo-list li {
    color: #6D4C41;
    font-size: 0.95rem;
    padding-left: 5px;
}

/* ==================== BOTONES ==================== */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(33, 150, 243, 0.2);
}

.btn-primary,
.btn-secondary {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(180deg, #4CAF50 0%, #388E3C 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(76, 175, 80, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #66BB6A 0%, #4CAF50 100%);
    transform: translateY(-3px);
    box-shadow: 
        0 6px 18px rgba(76, 175, 80, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(240, 245, 255, 0.9) 100%);
    border: 1px solid rgba(200, 220, 255, 0.6);
    color: #2196F3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, #2196F3 0%, #1976D2 100%);
    color: white;
    transform: translateY(-2px);
}

/* ==================== MODAL DE PREVIEW ==================== */
.modal-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.modal-content-large {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(245, 248, 255, 0.95) 100%);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(200, 220, 255, 0.8);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid rgba(33, 150, 243, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #2196F3;
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: linear-gradient(180deg, #E57373 0%, #F44336 100%);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.modal-close:hover {
    background: linear-gradient(180deg, #EF5350 0%, #E53935 100%);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid rgba(33, 150, 243, 0.2);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* ==================== PREVIEW CONTENT ==================== */
.preview-content {
    font-size: 1rem;
    line-height: 1.8;
    color: #2C3E50;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
    color: #2196F3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.preview-content h1 { font-size: 2rem; }
.preview-content h2 { font-size: 1.5rem; }
.preview-content h3 { font-size: 1.2rem; }

.preview-content p {
    margin-bottom: 1em;
}

.preview-content a {
    color: #2196F3;
    text-decoration: underline;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1em 0;
}

.preview-content code {
    background: rgba(33, 150, 243, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.preview-content pre {
    background: #2C3E50;
    color: #ECF0F1;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
}

.preview-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.preview-content blockquote {
    border-left: 4px solid #2196F3;
    padding-left: 20px;
    margin: 1em 0;
    color: #7F8C8D;
    font-style: italic;
}

.preview-content ul,
.preview-content ol {
    padding-left: 30px;
    margin: 1em 0;
}

.preview-content li {
    margin-bottom: 0.5em;
}

/* ==================== LOADING STATE ==================== */
.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 10px;
    margin-top: -8px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .main-container {
        padding: 20px 15px;
    }

    .crear-post-wrapper {
        padding: 25px 20px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .editor-toolbar {
        gap: 3px;
        padding: 8px;
    }

    .toolbar-btn {
        padding: 6px 10px;
        min-width: 32px;
        font-size: 0.9rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .modal-content-large {
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevenir zoom en iOS */
    }

    .protocolo-box {
        padding: 15px;
    }
}

/* ==================== DARK MODE SUPPORT ==================== */
@media (prefers-color-scheme: dark) {
    /* Opcional: agregar estilos dark si se desea */
}