/* Estil Base */
.cw-wrapper-pro {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 20px;
    max-width: 1000px;
    margin: 20px auto;
    color: #333;
}

.cw-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.cw-logo {
    font-size: 3rem;
    margin-bottom: 10px;
}

.cw-header h3 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.cw-header p {
    margin: 0;
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
}

/* Panell de Configuració */
.cw-panel-config {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    margin-bottom: 30px;
}

.cw-input-group {
    margin-bottom: 24px;
}

.cw-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 0.95rem;
}

.cw-title-row {
    display: flex;
    gap: 10px;
}

.cw-title-row .cw-input-text {
    flex: 1;
}

.cw-input-text, .cw-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.3s;
    background: #f8fafc;
}

.cw-input-text:focus, .cw-textarea:focus {
    border-color: #667eea;
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.cw-textarea {
    height: 140px;
    font-family: monospace;
    resize: vertical;
    line-height: 1.6;
}

.cw-input-group small {
    display: block;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Botons */
.cw-actions-row, .cw-game-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.cw-game-actions {
    justify-content: center;
    background: #f1f5f9;
    padding: 16px;
    border-radius: 12px;
}

.cw-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cw-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cw-btn:active {
    transform: translateY(0);
}

.cw-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cw-btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
}

.cw-btn-check {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.cw-btn-image {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.cw-btn-secondary {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.cw-btn-ai {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    padding: 14px 18px;
    font-size: 1.1rem;
    white-space: nowrap;
}

.cw-btn-share {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.cw-btn-copy {
    background: #334155;
    padding: 14px 20px;
    white-space: nowrap;
}

/* AI Status */
.cw-ai-status {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fef3c7;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #92400e;
    font-weight: 500;
}

.cw-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #fbbf24;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Share Box */
.cw-share-box {
    margin-top: 20px;
    background: #fffbeb;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #fde68a;
}

.cw-share-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #92400e;
}

.cw-share-row {
    display: flex;
    gap: 10px;
}

.cw-share-row .cw-input-text {
    flex: 1;
    background: white;
}

/* Missatges */
.cw-warning-box {
    margin-top: 20px;
    background: #fff7ed;
    border-left: 5px solid #fb923c;
    padding: 16px 20px;
    color: #9a3412;
    border-radius: 8px;
}

.cw-feedback-msg {
    text-align: center;
    padding: 16px 24px;
    margin-bottom: 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
}

.cw-msg-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.cw-msg-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Resultats */
.cw-result-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.cw-print-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #e2e8f0;
}

.cw-print-header h1 {
    margin: 0;
    font-size: 2.2rem;
    color: #1e293b;
    font-weight: 700;
}

.cw-grid-stage {
    display: flex;
    justify-content: center;
    padding: 20px;
    margin-bottom: 30px;
    background: #f8fafc;
    border-radius: 12px;
}

/* GRAELLA */
.cw-grid {
    display: grid;
    gap: 3px;
    padding: 8px;
    background: #cbd5e1;
    border-radius: 8px;
}

.cw-cell {
    width: 40px;
    height: 40px;
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cw-cell.active {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cw-cell.correct {
    background-color: #d1fae5 !important;
    border-color: #10b981 !important;
}

.cw-cell.incorrect {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
}

.cw-cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    background: transparent;
    text-transform: uppercase;
    outline: none;
    padding: 0;
    cursor: pointer;
}

.cw-cell input:focus {
    background: #eff6ff;
}

.cw-num-idx {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #667eea;
    pointer-events: none;
    line-height: 1;
}

/* Pistes */
.cw-clues-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    border-top: 3px solid #e2e8f0;
    padding-top: 30px;
    margin-top: 10px;
}

.cw-clue-col h4 {
    color: #667eea;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.cw-clue-col ul {
    padding-left: 0;
    list-style: none;
}

.cw-clue-col li {
    margin-bottom: 10px;
    line-height: 1.5;
    color: #475569;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.cw-footer-brand {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85rem;
    color: #94a3b8;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .cw-wrapper-pro {
        padding: 15px;
        margin: 10px;
        border-radius: 16px;
    }

    .cw-panel-config {
        padding: 20px;
    }

    .cw-clues-box {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cw-cell {
        width: 32px;
        height: 32px;
    }

    .cw-cell input {
        font-size: 16px;
    }

    .cw-title-row {
        flex-direction: column;
    }

    .cw-actions-row, .cw-game-actions {
        flex-direction: column;
    }

    .cw-btn {
        width: 100%;
        justify-content: center;
    }

    .cw-share-row {
        flex-direction: column;
    }
}
