/* ============================================
   MANLORE - APP.CSS
   Styles des composants et items
   ============================================ */

/* Stats Cards */
.stat-card {
    background: rgba(22, 33, 62, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(108, 92, 231, 0.3);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .items-grid {
        grid-template-columns: 1fr;
    }
}

/* Item Card */
.item-card {
    background: rgba(22, 33, 62, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(108, 92, 231, 0.3);
    border-color: rgba(108, 92, 231, 0.4);
}

.item-image {
    width: 100%;
    height: 320px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--bg-accent), var(--bg-secondary));
    position: relative;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, var(--bg-accent), var(--bg-secondary));
}

.item-type-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.item-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.item-status {
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.item-status.en-cours {
    background: rgba(0, 184, 148, 0.2);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.item-status.termine {
    background: rgba(108, 92, 231, 0.2);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.item-status.a-lire {
    background: rgba(253, 203, 110, 0.2);
    color: var(--color-warning);
    border: 1px solid var(--color-warning);
}

.item-status.abandonne {
    background: rgba(214, 48, 49, 0.2);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.item-status.en-pause {
    background: rgba(230, 126, 34, 0.2);
    color: #e67e22;
    border: 1px solid #e67e22;
}

.item-status.re-lecture {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid #3498db;
}

.item-rating {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.item-rating i {
    font-size: 0.875rem;
    color: var(--color-star);
}

.item-rating i.far {
    color: #444;
}

.item-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.genre-tag {
    background: rgba(108, 92, 231, 0.15);
    color: var(--color-secondary);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.item-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(108, 92, 231, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-chapters {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.item-action-btn {
    background: rgba(108, 92, 231, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.item-action-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.item-action-btn.delete:hover {
    background: var(--color-danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    display: block;
    margin-bottom: 1rem;
}

/* View Modal Specific Styles */
.view-modal-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .view-modal-content {
        grid-template-columns: 300px 1fr;
    }
}

.view-image-section {
    text-align: center;
}

.view-image-section img {
    width: 100%;
    max-width: 300px;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.view-image-placeholder {
    width: 100%;
    max-width: 300px;
    height: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--bg-accent), var(--bg-secondary));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.2);
}

.view-info-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.view-info-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.view-info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.view-info-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.view-notes {
    background: rgba(15, 52, 96, 0.3);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 92, 231, 0.2);
    line-height: 1.6;
    white-space: pre-wrap;
}

.view-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.view-link:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

.view-rating-large {
    display: flex;
    gap: 0.5rem;
    font-size: 1.5rem;
}

.view-rating-large i {
    color: var(--color-star);
}

.view-rating-large i.far {
    color: #444;
}

/* Action buttons in view modal */
.view-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(108, 92, 231, 0.2);
}

.btn-edit {
    flex: 1;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

.btn-delete {
    flex: 1;
    background: rgba(214, 48, 49, 0.2);
    color: var(--color-danger);
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-danger);
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-delete:hover {
    background: var(--color-danger);
    color: white;
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-card {
    animation: fadeInUp 0.4s ease forwards;
}

.item-card:nth-child(1) { animation-delay: 0.05s; }
.item-card:nth-child(2) { animation-delay: 0.1s; }
.item-card:nth-child(3) { animation-delay: 0.15s; }
.item-card:nth-child(4) { animation-delay: 0.2s; }
.item-card:nth-child(5) { animation-delay: 0.25s; }
.item-card:nth-child(6) { animation-delay: 0.3s; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .item-image {
        height: 280px;
    }
    
    .view-modal-content {
        grid-template-columns: 1fr;
    }
    
    .view-actions {
        flex-direction: column;
    }
}

/* Analytics Styles */
.stat-mini {
    background: rgba(15, 52, 96, 0.3);
    padding: 1.25rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.stat-mini-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

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

.insight-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    border-left: 4px solid;
}

.insight-info {
    background: rgba(108, 92, 231, 0.1);
    border-color: var(--color-primary);
}

.insight-success {
    background: rgba(0, 184, 148, 0.1);
    border-color: var(--color-success);
}

.insight-warning {
    background: rgba(253, 203, 110, 0.1);
    border-color: var(--color-warning);
}

.insight-card i {
    font-size: 1.5rem;
}

.progress-item {
    padding: 1rem;
    background: rgba(15, 52, 96, 0.2);
    border-radius: 0.75rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 8px;
    background: rgba(108, 92, 231, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width 0.5s ease;
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.stat-box {
    background: rgba(15, 52, 96, 0.3);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.stat-box-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-box-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.stat-box-percentage {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-secondary);
}

.genre-badge-large {
    background: rgba(108, 92, 231, 0.15);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(108, 92, 231, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rating-stars {
    min-width: 120px;
    color: var(--color-star);
}

.rating-bar {
    flex: 1;
    height: 12px;
    background: rgba(108, 92, 231, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.5s ease;
}

.rating-count {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(15, 52, 96, 0.2);
    border-radius: 0.5rem;
}

.top-rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    min-width: 50px;
}

.top-title {
    flex: 1;
}

.top-rating {
    color: var(--color-star);
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-month {
    min-width: 80px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.timeline-bar {
    flex: 1;
    height: 24px;
    background: rgba(108, 92, 231, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.timeline-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width 0.5s ease;
}

.timeline-count {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

/* Print styles */
@media print {
    .sidebar,
    header,
    .item-actions,
    .btn-primary,
    .btn-secondary {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .item-card {
        break-inside: avoid;
    }
}
