/* my-creations.css - Slide-out panel styles */

/* Overlay */
.creations-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}

.creations-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* En escriptori, amaguem l'overlay visualment i permetem clicar a través d'ell per usar el xat */
@media (min-width: 900px) {
    .creations-overlay {
        background: transparent;
        pointer-events: none;
    }
}

/* Panel */
.creations-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100%;
    height: 100%;
    background: #ffffff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.creations-panel.open {
    right: 0;
}

/* Quan el panell està obert, ajustar el xat i la barra d'input */
body.creations-open .right-panel {
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 900px) {
    body.creations-open .right-panel {
        margin-right: 450px;
    }
}

/* Header */
.creations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.creations-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.creations-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: white;
    transition: background 0.2s;
}

.creations-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Breadcrumb */
.creations-breadcrumb {
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: #6366f1;
    cursor: pointer;
    text-decoration: none;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #9ca3af;
}

.breadcrumb-current {
    color: #374151;
    font-weight: 600;
}

/* Controls */
.creations-controls {
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.new-folder-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.new-folder-btn:hover {
    background: #4f46e5;
}

.creations-search {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.creations-search:focus {
    border-color: #6366f1;
}

/* Grid */
.creations-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    align-content: start;
}

/* Cards */
.resource-card {
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.resource-card:hover {
    background: #f3f4f6;
    border-color: var(--card-color, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.resource-card.dragging {
    opacity: 0.5;
}

.resource-card.drag-over {
    border-color: #10b981;
    background: #ecfdf5;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 4px;
}

/* Card menu */
.card-menu-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.9rem;
}

.resource-card:hover .card-menu-btn {
    opacity: 1;
}

.card-menu-btn:hover {
    background: #f3f4f6;
}

/* Context Menu */

/* Centrar opcions del xat (barra inferior) */
#chat-options-row {
    justify-content: center !important;
}

/* Estil Input Barra Inferior */
.custom-chat-input-wrapper {
    display: flex;
    width: 100%;
    max-width: 800px;
    gap: 12px;
    align-items: center;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.custom-chat-input {
    flex: 1;
    border: 1px solid #22c55e;
    /* Green-500 equivalent */
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    color: #374151;
}

.custom-chat-input:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.custom-chat-send {
    background: #22c55e;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-chat-send:hover {
    background: #16a34a;
    /* Green-600 */
}

.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    min-width: 180px;
    padding: 6px 0;
    display: none;
}

.context-menu.show {
    display: block;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #374151;
}

.context-menu-item:hover {
    background: #f3f4f6;
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 0;
}

/* New folder input */
.new-folder-input {
    padding: 12px;
    background: #f0f9ff;
    border: 2px dashed #6366f1;
    border-radius: 12px;
    display: flex;
    gap: 8px;
}

.new-folder-input input {
    flex: 1;
    border: none;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}

.new-folder-input button {
    background: #6366f1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 1rem;
}

/* Loading */
.creations-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6366f1;
    font-size: 1.5rem;
}

/* Mobile */
@media (max-width: 500px) {
    .creations-panel {
        width: 100%;
        right: -100%;
    }

    .creations-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
}

/* Resultats Dashboard Natiu */
.res-dashboard {
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-top: 10px;
    height: 60vh;
    overflow-y: auto;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #1e293b;
    position: relative;
}

.res-header {
    margin-bottom: 20px;
    text-align: left;
}

.res-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #6a11cb;
    margin: 0;
}

.res-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.res-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.res-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.res-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
}

.res-stat-label {
    font-size: 0.8rem;
    color: #64748b;
}

.res-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.res-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
}

.res-select {
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.res-table-wrapper {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.res-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.res-table th {
    background: #f1f5f9;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.res-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
    color: #334155;
    vertical-align: middle;
}

.res-table tr:last-child td {
    border-bottom: none;
}

.res-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.75rem;
}

.res-pill.high {
    background: #dcfce7;
    color: #166534;
}

.res-pill.med {
    background: #fef9c3;
    color: #854d0e;
}

.res-pill.low {
    background: #fee2e2;
    color: #991b1b;
}

.res-action-btn {
    background: #6a11cb;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
}

.res-action-btn:hover {
    background: #5b21b6;
    transform: translateY(-1px);
}

/* Full width override per al xat */
.chat-message.plika.full-width {
    max-width: 100% !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    width: 100%;
    align-self: stretch;
}

.bubble.full-width {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 12px;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

/* Scrollbar fina */
.res-dashboard::-webkit-scrollbar {
    width: 6px;
}

.res-dashboard::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.res-dashboard::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.res-dashboard::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.res-dashboard {
    height: auto;
    min-height: 50vh;
    overflow: visible;
    /* Eliminar scroll intern */
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Gràfic de barres */
.res-chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.res-chart-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.res-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    box-sizing: content-box;
    /* Evitar problemes amb padding */
}

.res-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 15%;
    position: relative;
    height: 100%;
    justify-content: flex-end;
}

.res-bar {
    width: 80%;
    background: #6366f1;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    min-height: 4px;
    position: relative;
}

.res-bar:hover {
    opacity: 0.9;
}

.res-bar-label {
    margin-top: 10px;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

.res-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
}

/* Desviació */
.res-diff {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 6px;
    display: inline-block;
    min-width: 30px;
}

.res-diff.pos {
    color: #10b981;
}

.res-diff.neg {
    color: #ef4444;
}

.res-diff.neutral {
    color: #94a3b8;
}

/* ========================================
   GOOGLE CLASSROOM FORM
   ======================================== */
.classroom-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.classroom-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.classroom-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.classroom-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.classroom-subtitle {
    font-size: 0.9rem;
    color: #64748b;
}

.classroom-field {
    margin-bottom: 16px;
}

.classroom-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.classroom-select,
.classroom-input,
.classroom-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #334155;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.classroom-select:focus,
.classroom-input:focus,
.classroom-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.classroom-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

.classroom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.classroom-textarea {
    resize: vertical;
    min-height: 60px;
}

.classroom-radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.classroom-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
}

.classroom-radio input[type="radio"] {
    accent-color: #6366f1;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.classroom-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.classroom-chip {
    padding: 8px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.classroom-chip:hover {
    border-color: #6366f1;
    background: #f8fafc;
}

.classroom-chip.selected {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

.classroom-schedule-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.classroom-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 4px 0 12px 0;
}

.classroom-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-top: 16px;
}

.classroom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.classroom-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.classroom-btn.primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.classroom-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.classroom-btn.secondary {
    background: #f1f5f9;
    color: #475569;
}

.classroom-btn.secondary:hover {
    background: #e2e8f0;
}

.classroom-btn.cancel {
    background: transparent;
    color: #94a3b8;
}

.classroom-btn.cancel:hover {
    color: #64748b;
    background: #f8fafc;
}