:root {
    --bg-main: #f4f5f7;
    --bg-sidebar: #0f172a; /* Dark navy */
    --surface-color: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    --accent-color: #ff5722; /* Orange */
    --accent-hover: #f4511e;
    --border-color: #e5e7eb;
    --sidebar-width: 260px;
    
    /* Tags colors */
    --tag-moda: #e0f2fe;
    --tag-moda-text: #0284c7;
    --tag-prodotto: #fef3c7;
    --tag-prodotto-text: #d97706;
    --tag-social: #e0e7ff;
    --tag-social-text: #4f46e5;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    line-height: 1.5;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background-color: var(--surface-color);
    color: var(--bg-sidebar);
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
}

.logo-text {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-sidebar-active);
}

.nav-item.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--text-sidebar-active);
    border-left: 3px solid var(--accent-color);
    padding-left: calc(1rem - 3px);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: #475569;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-info {
    font-size: 0.8rem;
}

.user-name { color: white; font-weight: 500; }
.user-email { color: var(--text-sidebar); font-size: 0.75rem; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    background-color: var(--surface-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

/* Footer */
.app-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

/* Kanban Board & Content Area */
#app-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto; /* Allow vertical scrolling for all pages */
    padding: 1.5rem 2rem;
}

.kanban-board {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    overflow-x: auto; /* Allow kanban to scroll horizontally on desktop too */
    padding-bottom: 1rem;
}

.kanban-column {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
}

.column-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
}

.column-header .count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1rem;
    scrollbar-width: none;
}
.kanban-cards::-webkit-scrollbar { display: none; }

.add-card-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.add-card-btn:hover { color: var(--text-primary); }

/* Post Card */
.post-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.post-card-img {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background-color: #f3f4f6;
}

.post-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.post-card-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    width: fit-content;
}

.tag-moda { background-color: var(--tag-moda); color: var(--tag-moda-text); }
.tag-prodotto { background-color: var(--tag-prodotto); color: var(--tag-prodotto-text); }
.tag-social { background-color: var(--tag-social); color: var(--tag-social-text); }
.tag-default { background-color: #f1f5f9; color: #475569; }

.post-card-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.status-pronto {
    color: #10b981;
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.status-bozza {
    color: #6b7280;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
}

/* Post Detail View */
.post-detail-view {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    position: relative;
    padding-bottom: 5rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.btn-icon:hover { background-color: var(--bg-main); color: var(--text-primary); }

.detail-title-area {
    flex: 1;
    margin: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.detail-status {
    align-self: flex-start;
}

.detail-meta {
    padding: 1rem 1.5rem;
}

.detail-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-date span {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    gap: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.detail-tab-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.material-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.material-item {
    background-color: #f1f5f9;
    border-radius: var(--radius-md);
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
}

.main-material {
    grid-column: span 2;
    grid-row: span 2;
}

.material-add-btn {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    aspect-ratio: 1;
    transition: all 0.2s;
}

.material-add-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.material-add-btn span {
    font-size: 1.5rem;
}

.material-add-btn p {
    font-size: 0.75rem;
    font-weight: 500;
}

.detail-info-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.info-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.channel-icons {
    display: flex;
    gap: 0.5rem;
}

.channel-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}
.instagram { background-color: #e1306c; }
.facebook { background-color: #1877f2; }
.pinterest { background-color: #bd081c; }

.format-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--surface-color);
}

.fab-edit {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.fab-edit:hover {
    transform: scale(1.05);
}

/* Tabs e Checklist */
.detail-tab-content {
    display: none;
}
.detail-tab-content.active-tab {
    display: flex;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
}

.progress-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--accent-color);
}

.progress-stats {
    display: flex;
    flex-direction: column;
}

.progress-completed {
    font-size: 1.25rem;
    font-weight: 700;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
}

.todo-item.completed {
    opacity: 0.6;
}

.todo-item.completed span {
    text-decoration: line-through;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.todo-text {
    flex: 1;
    font-size: 0.9rem;
}

.btn-remove-todo {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}
.btn-remove-todo:hover { background-color: #fef2f2; }

.add-todo-wrapper {
    display: flex;
    gap: 1rem;
}

.input-todo, .input-caption, .input-hashtags, .input-notes {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.input-todo:focus, .input-caption:focus, .input-hashtags:focus, .input-notes:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn-add-todo {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
}
.btn-add-todo:hover { background-color: var(--bg-main); }

/* Caption List */
.caption-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.caption-item {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    position: relative;
}

.caption-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.caption-version {
    font-weight: 600;
    color: var(--text-primary);
}

.caption-text {
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.caption-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-small {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.btn-small:hover { background-color: var(--bg-main); }

.add-caption-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-end;
}
.add-caption-wrapper textarea { width: 100%; }

/* --- LIBRERIA MEDIA --- */
.media-library {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.media-tabs {
    display: flex;
    gap: 1.5rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.media-grid-container {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.media-thumb {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: #f1f5f9;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.media-thumb:hover::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.1);
}

.media-thumb.favorite::before {
    content: '★';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: #f59e0b;
    font-size: 1.2rem;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.media-tags-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.media-tags-footer p {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.media-tags-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.media-tag {
    background-color: var(--bg-main);
    padding: 0.3rem 0.75rem;
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.media-tag:hover { background-color: var(--surface-color); color: var(--text-primary); }

/* --- HASHTAG LIBRARY --- */
.hashtag-library {
    height: 100%;
    overflow-y: auto;
}

.hashtag-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.hashtag-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.hashtag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hashtag-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.hashtag-actions {
    display: flex;
    gap: 0.5rem;
}

.hashtag-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.hashtag-count {
    font-size: 0.75rem;
    color: var(--text-sidebar);
}

/* --- PANORAMICA --- */
.panoramica-container { padding: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface-color); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.stat-card h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 500; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--text-primary); }
.stat-number.stat-pronto { color: #10b981; }
.stat-number.stat-bozza { color: #f59e0b; }
.placeholder-section { background: var(--surface-color); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.placeholder-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }

/* --- CALENDAR --- */
.calendar-container { background: var(--surface-color); padding: 1.5rem; border-radius: var(--radius-md); height: 100%; display: flex; flex-direction: column; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.calendar-nav button { background: none; border: 1px solid var(--border-color); padding: 0.5rem 1rem; cursor: pointer; border-radius: 4px; }
.calendar-nav button:hover { background: var(--bg-main); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-color); flex: 1; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.cal-day { background: var(--bg-main); padding: 0.5rem; font-size: 0.8rem; font-weight: 600; text-align: center; color: var(--text-secondary); }
.cal-cell { background: var(--surface-color); padding: 0.5rem; font-size: 0.9rem; min-height: 80px; }
.cal-cell.empty { background: var(--bg-main); }
.cal-event { margin-top: 0.5rem; font-size: 0.75rem; padding: 0.25rem 0.5rem; background: #dbeafe; color: #1e3a8a; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.draft { background: #fef3c7; color: #92400e; }

/* --- IDEE VELOCI --- */
.idee-container { max-width: 600px; margin: 0 auto; padding: 1.5rem; }
.add-idea-wrapper { display: flex; gap: 1rem; margin-bottom: 2rem; }
#input-idea { flex: 1; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: 1rem; outline: none; }
#input-idea:focus { border-color: var(--accent-color); }
.idee-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.idea-item { background: var(--surface-color); padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem;}

/* --- STATISTICHE --- */
.stats-page-container { padding: 1.5rem; }
.chart-mock { background: var(--surface-color); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); max-width: 500px; }
.bar-chart { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.bar-row { display: flex; align-items: center; gap: 1rem; }
.bar-label { width: 50px; font-size: 0.8rem; color: var(--text-secondary); }
.bar { height: 20px; background: var(--accent-color); border-radius: 4px; }
.bar-val { font-size: 0.8rem; font-weight: 600; }

/* --- IMPOSTAZIONI --- */
.settings-container { max-width: 600px; margin: 0 auto; padding: 1.5rem; }
.setting-group { background: var(--surface-color); padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.setting-group h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--bg-main); cursor: pointer; font-size: 0.95rem;}
.setting-item:last-child { border-bottom: none; }
.danger-zone { border-color: #fca5a5; background: #fef2f2; }
.danger-zone h3, .danger-zone p { color: #991b1b; }
.danger-zone p { font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.5; }

/* ==========================================
   TABLE VIEW (AIRTABLE STYLE)
   ========================================== */
.table-container {
    width: 100%;
    height: 100%;
    overflow: auto; /* Permette scrolling sia X che Y */
    background: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.content-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
    font-size: 0.85rem;
}

.content-table thead {
    position: sticky;
    top: 0;
    background-color: #f8fafc;
    z-index: 10;
}

.content-table th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.content-table th:last-child {
    border-right: none;
}

.content-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    vertical-align: middle;
}

.content-table td:last-child {
    border-right: none;
}

.content-table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Badges per la tabella */
.badge-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

/* Colori Categorie */
.cat-piedini { background-color: #dcfce7; color: #166534; }
.cat-utilita { background-color: #e0f2fe; color: #0284c7; }
.cat-ironia { background-color: #ffedd5; color: #c2410c; }
.cat-lifestyle { background-color: #f3e8ff; color: #6b21a8; }
.cat-default { background-color: #f1f5f9; color: #475569; }

/* Colori Stati */
.stat-idea { background-color: #f3f4f6; color: #4b5563; }
.stat-produrre { background-color: #fee2e2; color: #991b1b; }
.stat-lavorazione { background-color: #fef3c7; color: #92400e; }
.stat-pronto { background-color: #ecfdf5; color: #065f46; }

/* Colori Priorità */
.prio-alta { color: #dc2626; font-weight: 600; }
.prio-alta::before { content: "● "; color: #dc2626; }
.prio-media { color: #d97706; font-weight: 600; }
.prio-media::before { content: "● "; color: #f59e0b; }
.prio-bassa { color: #059669; font-weight: 600; }
.prio-bassa::before { content: "● "; color: #10b981; }

/* Progress Bar */
.pct-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pct-bar-bg {
    width: 60px;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.pct-bar-fill {
    height: 100%;
    background-color: #10b981;
    border-radius: 3px;
}
.pct-text {
    font-weight: 600;
    width: 35px;
}

/* ==========================================
   DETAIL VIEW TABS & LAYOUT
   ========================================== */
.detail-tabs-v2 {
    display: flex;
    gap: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.detail-tabs-v2 .tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}
.detail-tabs-v2 .tab-btn:hover { color: var(--text-primary); }
.detail-tabs-v2 .tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
    font-weight: 600;
}

/* Tabbed Layout Container */
.detail-grid-v2.tabbed-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Hide inactive tab panes */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-pane.active {
    display: block;
}

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

/* ==========================================
   DETAIL VIEW V2 (DASHBOARD)
   ========================================== */
.post-detail-view-v2 {
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 5rem;
}

.detail-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detail-title-input {
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-primary);
    width: 300px;
}

.detail-badges {
    display: flex;
    gap: 0.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Completion Circle Widget */
.completion-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.circular-chart {
    display: block;
    width: 40px;
    height: 40px;
}
.circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 3.8;
}
.circle {
    fill: none;
    stroke: #10b981;
    stroke-width: 3.8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}
.percentage {
    fill: var(--text-primary);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
}
.completion-text {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
}
.completion-text strong { color: var(--text-primary); }
.completion-text span { color: var(--text-secondary); }

/* Tabs V2 */
.detail-tabs-v2 {
    display: flex;
    gap: 2rem;
    padding: 0 2rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

/* Grid Layout */
.detail-grid-v2 {
    display: grid;
    grid-template-columns: 350px 1fr 280px;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    align-items: start;
}

.dashboard-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.dashboard-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* IG Mockup */
.ig-mockup {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}
.ig-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
}
.ig-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
}
.ig-image-area {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    background: #f1f5f9;
}
.ig-image-area img {
    width: 100%; height: 100%; object-fit: cover;
}
.ig-reel-icon {
    position: absolute;
    bottom: 10px; right: 10px;
    color: white; font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.ig-actions {
    padding: 0.75rem;
    font-size: 1.2rem;
    border-top: 1px solid var(--border-color);
}
.ig-caption-preview {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.85rem;
}

/* Data Row */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.data-row:last-child { border-bottom: none; }
.data-row label { color: var(--text-secondary); width: 40%; }
.data-row select, .data-row input {
    border: none;
    text-align: right;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    width: 60%;
}
.data-row select:focus, .data-row input:focus { outline: none; }

/* Sub Cards Grid */
.sub-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* AI Tips */
.ai-card {
    background: #fef3c7;
    border-color: #fde68a;
}
.ai-badge {
    background: #f59e0b;
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.btn-ai-small {
    background: #d97706;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* Checklist items */
.gen-check-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.gen-check-item.completed {
    color: #10b981;
    font-weight: 500;
}

/* ==========================================
   RESPONSIVITÀ (MOBILE & TABLET)
   ========================================== */

/* Nascondi di default su desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 1rem;
    padding: 0.5rem;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}
.page-title-group {
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    /* Top Bar & Header */
    .mobile-menu-btn { display: block; }
    .top-bar { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1rem; }
    .page-title h1 { font-size: 1.25rem; }
    .page-title p { font-size: 0.8rem; }
    .top-bar-actions { width: 100%; display: flex; }
    .top-bar-actions button { flex: 1; justify-content: center; }

    /* Sidebar Off-canvas */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open {
        left: 0;
    }

    /* Contenitore principale su mobile */
    #app-content {
        padding: 1rem;
    }

    /* Nascondi display orizzontale Kanban precedente, ora usiamo Table */
    .table-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Detail View impilata (v2) */
    .detail-grid-v2 {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .sub-cards-grid {
        grid-template-columns: 1fr;
    }
    .detail-header-v2 {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .detail-title-input {
        width: 100%;
    }

    /* Detail View impilata */
    .detail-content {
        grid-template-columns: 1fr; /* colonna singola */
        gap: 1.5rem;
    }
    .detail-left {
        order: -1; /* Manda l'immagine sopra */
    }

    /* Griglie e Liste */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .hashtag-grid-container {
        grid-template-columns: 1fr;
    }
    .media-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .hashtag-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .hashtag-title-edit {
        width: 100% !important;
    }
    
    /* Calendar */
    .calendar-grid {
        font-size: 0.8rem;
    }
    .cal-cell {
        min-height: 60px;
        padding: 0.2rem;
    }
    .cal-event {
        font-size: 0.65rem;
        padding: 0.1rem 0.2rem;
    }
}

/* ==========================================
   UI POLISH & MODERNIZATION (Overrides)
   ========================================== */
button {
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary, .btn-secondary, .btn-add-todo, .btn-save-caption, .btn-save-hashtags, .btn-save-notes, .btn-sugg {
    padding: 0.6rem 1.2rem;
    border-radius: 8px; /* Più arrotondati */
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Ombra leggera */
    border: none;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}
.btn-primary:hover {
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-ai-small, .btn-ai-solid {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 6px;
}
.btn-ai-small:hover, .btn-ai-solid:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
}

.btn-ai-outline {
    border: 1px solid #fcd34d !important;
    color: #b45309 !important;
    background: transparent !important;
    font-weight: 600;
    border-radius: 6px !important;
    transition: background 0.2s;
}
.btn-ai-outline:hover {
    background: #fef3c7 !important;
}

select, input[type="text"], input[type="date"], textarea {
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    padding: 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Tab buttons modernization */
.tab-btn {
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.75rem 0.5rem;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: #10b981;
}

/* ==========================================
   ARCHIVIO TABS & COMING SOON
   ========================================== */
.archivio-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.archivio-tabs {
    display: flex;
    gap: 1rem;
    padding: 0 0 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.archivio-tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}
.archivio-tab-btn:hover {
    color: var(--text-primary);
}
.archivio-tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}
.archivio-content {
    flex: 1;
    overflow-y: auto;
}

.coming-soon-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    padding: 2rem;
    color: var(--text-secondary);
}
.coming-soon-view h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
