/**
 * CSI Whistleblowing - Frontend Styles
 */

:root {
    --csi-primary: #0a3d62;
    --csi-primary-hover: #072e4a;
    --csi-accent: #00a8ff;
    --csi-danger: #e74c3c;
    --csi-warning: #f39c12;
    --csi-success: #27ae60;
    --csi-bg: #f8fafc;
    --csi-border: #e2e8f0;
    --csi-text: #2c3e50;
    --csi-text-muted: #64748b;
    --csi-radius: 8px;
    --csi-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.csi-wb-container {
    max-width: 860px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--csi-text);
    background: #fff;
    border-radius: var(--csi-radius);
    box-shadow: var(--csi-shadow);
    overflow: hidden;
    border: 1px solid var(--csi-border);
}

.csi-wb-header {
    background: linear-gradient(135deg, var(--csi-primary) 0%, #1e5a87 100%);
    color: #fff;
    padding: 28px 30px;
    border-bottom: 3px solid var(--csi-accent);
}

.csi-wb-header h2 {
    color: #fff;
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
}

.csi-wb-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
    line-height: 1.5;
}

.csi-wb-nav {
    display: flex;
    background: #eef2f6;
    border-bottom: 1px solid var(--csi-border);
}

.csi-wb-tab-btn {
    flex: 1;
    padding: 14px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--csi-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.csi-wb-tab-btn:hover {
    color: var(--csi-primary);
    background: #f1f5f9;
}

.csi-wb-tab-btn.active {
    color: var(--csi-primary);
    background: #fff;
    border-bottom-color: var(--csi-accent);
}

.csi-wb-tab-content {
    display: none;
    padding: 30px;
}

.csi-wb-tab-content.active {
    display: block;
}

/* Card & Form controls */
.csi-card-box {
    background: var(--csi-bg);
    border: 1px solid var(--csi-border);
    border-radius: var(--csi-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.csi-card-box h3, .csi-card-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--csi-primary);
}

.csi-form-group {
    margin-bottom: 18px;
}

.csi-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.csi-form-group input[type="text"],
.csi-form-group input[type="email"],
.csi-form-group select,
.csi-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--csi-border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.csi-form-group input:focus,
.csi-form-group select:focus,
.csi-form-group textarea:focus {
    border-color: var(--csi-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.15);
}

.csi-row {
    display: flex;
    gap: 15px;
}

.csi-col {
    flex: 1;
}

/* Radios custom */
.csi-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.csi-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

/* Microfono & Registratore */
.csi-voice-recorder-area {
    text-align: center;
    padding: 30px 20px;
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: var(--csi-radius);
}

.csi-btn-record {
    background: var(--csi-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(10, 61, 98, 0.2);
}

.csi-btn-record:hover {
    background: var(--csi-primary-hover);
    transform: translateY(-2px);
}

.csi-btn-record.is-recording {
    background: var(--csi-danger);
    animation: csi-pulse 1.4s infinite;
}

@keyframes csi-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); }
    70% { transform: scale(1.04); box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { transform: scale(1); }
}

.csi-record-timer {
    font-family: monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--csi-danger);
    margin-top: 12px;
}

.csi-status-text {
    margin-top: 10px;
    font-size: 14px;
    color: var(--csi-text-muted);
}

.text-recording {
    color: var(--csi-danger);
    font-weight: 600;
}

.csi-audio-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: 6px;
}

/* Pulsanti */
.csi-btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.csi-btn-primary {
    background: var(--csi-primary);
    color: #fff;
}

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

.csi-btn-secondary {
    background: #475569;
    color: #fff;
}

.csi-btn-secondary:hover {
    background: #334155;
}

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

/* Modal Successo Key Code */
.csi-modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    padding: 20px;
    overflow-y: auto;
}

.csi-modal-box {
    background: #fff;
    max-width: 550px;
    margin: 60px auto;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.csi-key-code-display {
    background: #f8fafc;
    border: 2px dashed var(--csi-accent);
    padding: 15px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--csi-primary);
    border-radius: 6px;
    margin: 20px 0;
    user-select: all;
    font-family: monospace;
}

/* Chat & Status cards */
.csi-status-card {
    background: #fff;
    border: 1px solid var(--csi-border);
    border-radius: var(--csi-radius);
    padding: 22px;
}

.csi-status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.csi-status-pill {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.csi-status-received { background: #e0f2fe; color: #0369a1; }
.csi-status-in_progress { background: #fef3c7; color: #b45309; }
.csi-status-info_requested { background: #ede9fe; color: #6d28d9; }
.csi-status-accepted { background: #dcfce7; color: #15803d; }
.csi-status-closed { background: #f1f5f9; color: #475569; }

.csi-messages-container {
    background: #f8fafc;
    border: 1px solid var(--csi-border);
    border-radius: 6px;
    padding: 15px;
    max-height: 380px;
    overflow-y: auto;
}

.csi-msg-bubble {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
}

.csi-msg-odv {
    background: #e2e8f0;
    margin-right: auto;
    border-left: 4px solid var(--csi-primary);
}

.csi-msg-user {
    background: #e0f2fe;
    margin-left: auto;
    border-right: 4px solid var(--csi-accent);
}

.csi-msg-sender {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #475569;
}

.csi-msg-time {
    font-weight: 400;
    opacity: 0.8;
}

.csi-alert {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.csi-alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.csi-alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.csi-alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

@media (max-width: 640px) {
    .csi-row { flex-direction: column; gap: 10px; }
    .csi-status-header { flex-direction: column; gap: 12px; }
}
