/* ===================================
   Canal de Denuncias del Grec
   Estilos del formulario público
====================================== */

/* Variables */
:root {
    --cd-primary: #C1544B;
    --cd-primary-dark: #a84840;
    --cd-dark: #1e2023;
    --cd-gray: #868d98;
    --cd-light-gray: #f8f9fa;
    --cd-border: #e0e0e0;
    --cd-success: #27ae60;
    --cd-error: #e74c3c;
    --cd-warning: #f39c12;
}

/* Container principal */
.canal-denuncias-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Tabs de navegación */
.cd-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--cd-border);
    padding-bottom: 0;
}

.cd-tab {
    padding: 15px 25px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--cd-gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
}

.cd-tab:hover {
    color: var(--cd-primary);
}

.cd-tab.active {
    color: var(--cd-primary);
    border-bottom-color: var(--cd-primary);
}

/* Paneles de contenido */
.cd-panel {
    display: none;
}

.cd-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Formulario */
.cd-form {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.cd-form-section {
    margin-bottom: 30px;
}

.cd-form-section h3 {
    font-size: 18px;
    color: var(--cd-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--cd-light-gray);
}

/* Grupos de formulario */
.cd-form-group {
    margin-bottom: 20px;
}

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

.cd-form-group label .required {
    color: var(--cd-error);
}

.cd-form-group .help-text {
    font-size: 13px;
    color: var(--cd-gray);
    margin-top: 5px;
}

/* Inputs */
.cd-input,
.cd-select,
.cd-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--cd-border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cd-input:focus,
.cd-select:focus,
.cd-textarea:focus {
    outline: none;
    border-color: var(--cd-primary);
    box-shadow: 0 0 0 3px rgba(193, 84, 75, 0.1);
}

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

.cd-input.error,
.cd-select.error,
.cd-textarea.error {
    border-color: var(--cd-error);
}

.cd-error-message {
    color: var(--cd-error);
    font-size: 13px;
    margin-top: 5px;
}

/* Sección de archivos */
.cd-file-upload {
    border: 2px dashed var(--cd-border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.cd-file-upload:hover {
    border-color: var(--cd-primary);
    background: rgba(193, 84, 75, 0.02);
}

.cd-file-upload.dragover {
    border-color: var(--cd-primary);
    background: rgba(193, 84, 75, 0.05);
}

.cd-file-upload input[type="file"] {
    display: none;
}

.cd-file-upload-icon {
    font-size: 40px;
    color: var(--cd-gray);
    margin-bottom: 10px;
}

.cd-file-upload-text {
    color: var(--cd-gray);
}

.cd-file-upload-text strong {
    color: var(--cd-primary);
}

.cd-file-list {
    margin-top: 15px;
}

.cd-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--cd-light-gray);
    border-radius: 6px;
    margin-bottom: 8px;
}

.cd-file-item-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-file-item-remove {
    background: none;
    border: none;
    color: var(--cd-error);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

/* Sección de identidad */
.cd-identity-toggle {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.cd-identity-option {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--cd-border);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.cd-identity-option:hover {
    border-color: var(--cd-primary);
}

.cd-identity-option.selected {
    border-color: var(--cd-primary);
    background: rgba(193, 84, 75, 0.05);
}

.cd-identity-option input[type="radio"] {
    display: none;
}

.cd-identity-fields {
    display: none;
}

.cd-identity-fields.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Botones */
.cd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

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

.cd-btn-secondary {
    background: var(--cd-light-gray);
    color: var(--cd-dark);
}

.cd-btn-secondary:hover {
    background: #e9ecef;
}

.cd-btn-outline {
    background: transparent;
    color: var(--cd-primary);
    border: 2px solid var(--cd-primary);
}

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

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

.cd-btn-block {
    width: 100%;
}

/* Privacy notice */
.cd-privacy-notice {
    font-size: 13px;
    color: var(--cd-gray);
    margin-top: 20px;
    padding: 15px;
    background: var(--cd-light-gray);
    border-radius: 8px;
}

/* Consulta de estado */
.cd-status-form {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.cd-code-input {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
}

/* Panel de estado */
.cd-status-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.cd-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--cd-light-gray);
}

.cd-status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.cd-status-badge.recibida { background: #e3f2fd; color: #1976d2; }
.cd-status-badge.en_revision { background: #fff3e0; color: #f57c00; }
.cd-status-badge.investigacion { background: #fce4ec; color: #c2185b; }
.cd-status-badge.resuelta { background: #e8f5e9; color: #388e3c; }
.cd-status-badge.archivada { background: #f5f5f5; color: #757575; }

.cd-status-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.cd-info-card {
    background: var(--cd-light-gray);
    padding: 15px;
    border-radius: 8px;
}

.cd-info-card-label {
    font-size: 12px;
    color: var(--cd-gray);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.cd-info-card-value {
    font-weight: 600;
    color: var(--cd-dark);
}

/* Chat de mensajes */
.cd-messages-section {
    margin-top: 30px;
}

.cd-messages-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.cd-messages-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: var(--cd-light-gray);
    border-radius: 8px;
    margin-bottom: 20px;
}

.cd-message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 12px;
    max-width: 80%;
}

.cd-message.denunciante {
    background: white;
    margin-right: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cd-message.admin {
    background: var(--cd-primary);
    color: white;
    margin-left: auto;
}

.cd-message-header {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.cd-message-content {
    line-height: 1.5;
    white-space: pre-wrap;
}

.cd-message-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cd-message-form textarea {
    flex: 1;
    min-height: 80px;
}

.cd-message-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cd-attach-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-attach-wrapper input[type="file"] {
    display: none;
}

.cd-btn-attach {
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
}

.cd-files-count {
    font-size: 13px;
    color: var(--cd-gray);
}

/* Archivos adjuntos en mensajes */
.cd-message-attachments {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cd-message.admin .cd-message-attachments {
    border-top-color: rgba(255,255,255,0.2);
}

.cd-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    font-size: 12px;
    color: var(--cd-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.cd-attachment-link:hover {
    background: rgba(0,0,0,0.1);
}

.cd-message.admin .cd-attachment-link {
    background: rgba(255,255,255,0.2);
    color: white;
}

.cd-message.admin .cd-attachment-link:hover {
    background: rgba(255,255,255,0.3);
}

/* Documentos recibidos del admin */
.cd-documents-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--cd-light-gray);
}

.cd-documents-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--cd-dark);
}

.cd-documents-section h3 i {
    color: var(--cd-primary);
}

.cd-documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cd-document-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--cd-light-gray);
    border-radius: 10px;
    border-left: 4px solid var(--cd-primary);
    transition: all 0.3s ease;
}

.cd-document-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.cd-document-item.expired {
    border-left-color: var(--cd-gray);
    opacity: 0.7;
}

.cd-document-item.downloaded {
    border-left-color: var(--cd-success);
}

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

.cd-document-name {
    font-weight: 600;
    color: var(--cd-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.cd-document-name i {
    color: var(--cd-primary);
    font-size: 18px;
}

.cd-document-desc {
    font-size: 14px;
    color: var(--cd-gray);
    margin-bottom: 8px;
    line-height: 1.4;
}

.cd-document-meta {
    font-size: 12px;
    color: var(--cd-gray);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.cd-doc-status {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.cd-doc-status.downloaded {
    background: #d4edda;
    color: #155724;
}

.cd-doc-status.expired {
    background: #f5f5f5;
    color: #757575;
}

.cd-document-action {
    margin-left: 20px;
    flex-shrink: 0;
}

.cd-document-action .cd-btn-small {
    padding: 10px 18px;
    font-size: 14px;
}

.cd-doc-expired-label {
    display: inline-block;
    padding: 8px 16px;
    background: #f5f5f5;
    color: #757575;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

/* Responsive documentos */
@media (max-width: 576px) {
    .cd-document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .cd-document-action {
        margin-left: 0;
        width: 100%;
    }

    .cd-document-action .cd-btn {
        width: 100%;
    }
}

/* Modal de éxito */
.cd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.cd-modal {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.cd-modal-header {
    background: var(--cd-success);
    color: white;
    padding: 30px;
    text-align: center;
}

.cd-modal-header-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.cd-modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.cd-modal-header p {
    margin: 10px 0 0 0;
    opacity: 0.9;
}

/* Modal de éxito especial - MUY LLAMATIVO */
.cd-modal-success {
    max-width: 550px;
}

.cd-modal-header-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    padding: 25px 20px;
    flex-shrink: 0;
}

.cd-modal-header-success .cd-modal-header-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #27ae60;
    margin: 0 auto 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.cd-modal-header-success h2 {
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cd-code-section {
    margin-bottom: 25px;
}

.cd-code-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.cd-code-display-large {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 3px dashed var(--cd-primary);
    padding: 15px;
}

.cd-code-display-large code {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--cd-primary);
    display: block;
    text-align: center;
}

.cd-warning-box {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.cd-warning-critical {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border: 2px solid #ffc107;
}

.cd-warning-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.cd-warning-content {
    font-size: 13px;
    line-height: 1.5;
}

.cd-warning-content strong {
    display: block;
    font-size: 14px;
    color: #856404;
    margin-bottom: 8px;
}

.cd-warning-content p {
    margin: 5px 0;
    color: #856404;
}

.cd-btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    font-size: 18px;
}

.cd-btn-success:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
}

.cd-btn-large {
    padding: 18px 30px;
}

.cd-btn-small {
    padding: 10px 20px;
    font-size: 14px;
    opacity: 0.8;
}

.cd-btn-small:hover {
    opacity: 1;
}

.cd-modal-body {
    padding: 30px;
    text-align: center;
    overflow-y: auto;
    flex: 1;
}

.cd-code-display {
    background: var(--cd-light-gray);
    border: 2px dashed var(--cd-primary);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.cd-code-display code {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--cd-primary);
}

.cd-code-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    margin: 20px 0;
}

.cd-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Alertas */
.cd-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cd-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cd-alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading */
.cd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

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

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

/* Garantía de anonimato */
.cd-anonymity-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cd-anonymity-badge-icon {
    font-size: 24px;
}

.cd-anonymity-badge-text {
    font-size: 14px;
}

.cd-anonymity-badge-text strong {
    display: block;
    font-size: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .cd-form {
        padding: 20px;
    }

    .cd-tabs {
        flex-direction: column;
        gap: 0;
    }

    .cd-tab {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .cd-tab.active {
        border-bottom: none;
        border-left-color: var(--cd-primary);
    }

    .cd-identity-toggle {
        flex-direction: column;
    }

    .cd-status-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .cd-message-form {
        flex-direction: column;
    }
}

/* Responsive Modal - Pantallas pequeñas */
@media (max-width: 600px) {
    .cd-modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .cd-modal {
        max-height: 95vh;
    }

    .cd-modal-success {
        max-width: 100%;
    }

    .cd-modal-header-success {
        padding: 15px;
    }

    .cd-modal-header-success .cd-modal-header-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
        margin-bottom: 10px;
    }

    .cd-modal-header-success h2 {
        font-size: 18px;
    }

    .cd-modal-header-success p {
        font-size: 13px;
    }

    .cd-modal-body {
        padding: 15px;
    }

    .cd-code-section {
        margin-bottom: 15px;
    }

    .cd-code-title {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .cd-code-display-large {
        padding: 12px;
    }

    .cd-code-display-large code {
        font-size: 16px;
        letter-spacing: 1px;
        word-break: break-all;
    }

    .cd-warning-box {
        padding: 12px;
        margin-bottom: 15px;
        flex-direction: column;
        text-align: left;
    }

    .cd-warning-icon {
        font-size: 24px;
    }

    .cd-warning-content {
        font-size: 12px;
    }

    .cd-warning-content strong {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .cd-warning-content p {
        margin: 4px 0;
    }

    .cd-btn-success {
        font-size: 14px;
    }

    .cd-btn-large {
        padding: 14px 20px;
    }

    .cd-modal-actions {
        gap: 8px;
    }

    .cd-modal-actions hr {
        margin: 12px 0 !important;
    }
}