/* ============================================
   TEMPLATES & CHECKLISTS - Professional Styles
   boardr.it Application
   ============================================ */

/* ========== TEMPLATE CARDS ========== */

.template-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--color-neutral-200);
    overflow: hidden;
}

.template-card .card-text {
    text-decoration: none !important;
}

.template-card:hover .card-text {
    text-decoration: none !important;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-300);
}

.template-card .card-header {
    background: linear-gradient(135deg, var(--color-neutral-0), var(--color-neutral-50));
    border-bottom: 1px solid var(--color-neutral-200);
    transition: all 0.3s ease;
}

.template-card:hover .card-header {
    background: linear-gradient(135deg, var(--color-primary-50), var(--color-primary-100));
}

.template-preview {
    position: relative;
}

/* ========== CHECKLIST STYLES ========== */

.checklist-items-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.checklist-items-container::-webkit-scrollbar {
    width: 6px;
}

.checklist-items-container::-webkit-scrollbar-track {
    background: var(--color-neutral-100);
    border-radius: 3px;
}

.checklist-items-container::-webkit-scrollbar-thumb {
    background: var(--color-neutral-300);
    border-radius: 3px;
}

.checklist-items-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-neutral-400);
}

.checklist-item {
    background: var(--color-neutral-0);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.checklist-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-primary-300);
}

.checklist-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.checklist-item-placeholder {
    background: var(--color-primary-50);
    border: 2px dashed var(--color-primary-400);
    border-radius: var(--radius-md);
    margin: 8px 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.drag-handle {
    cursor: grab;
    color: var(--color-neutral-400);
    transition: all 0.2s ease;
    padding: 8px;
}

.drag-handle:hover {
    color: var(--color-primary-600);
    transform: scale(1.2);
}

.drag-handle:active {
    cursor: grabbing;
    transform: scale(1.1);
}

/* ========== EMPTY STATES ========== */

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--color-neutral-400);
    background: var(--color-neutral-50);
    border: 2px dashed var(--color-neutral-300);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.empty-state:hover {
    border-color: var(--color-primary-400);
    background: var(--color-primary-50);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.empty-state:hover i {
    transform: scale(1.1);
    opacity: 1;
}

/* ========== QUICK TEMPLATE BUTTONS ========== */

.quick-template-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.quick-template-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(var(--color-primary-500-rgb), 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.quick-template-btn:hover::before {
    width: 300px;
    height: 300px;
}

.quick-template-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-400);
    color: var(--color-primary-700);
}

/* ========== TEMPLATE STATS ========== */

.template-stats .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
}

/* ========== PROGRESS INDICATORS ========== */

.progress-template {
    height: 8px;
    background: var(--color-neutral-200);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-template .progress-bar {
    background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-600));
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-template .progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========== MODAL STYLES ========== */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--color-neutral-200);
    background: linear-gradient(135deg, var(--color-neutral-0), var(--color-neutral-50));
}

.modal-footer {
    border-top: 1px solid var(--color-neutral-200);
    background: var(--color-neutral-50);
}

/* ========== ANIMATIONS ========== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.template-card {
    animation: fadeIn 0.5s ease-out;
}

.checklist-item {
    animation: slideIn 0.3s ease-out;
}

/* ========== NOTIFICATION STYLES ========== */

.template-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== SECTION STYLES ========== */

.section {
    background: var(--color-neutral-0);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary-500);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section:hover::before {
    opacity: 1;
}

.section-title {
    color: var(--color-neutral-600);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.section-title i {
    color: var(--color-primary-500);
}

/* ========== CHECKLIST ITEM STATES ========== */

.checklist-item-completed {
    opacity: 0.7;
    background: var(--color-success-50);
}

.checklist-item-completed .form-control {
    text-decoration: line-through;
    color: var(--color-neutral-500);
}

.checklist-item-required {
    border-left: 3px solid var(--color-warning-500);
}

/* ========== TEMPLATE DETAILS HEADER BUTTONS ========== */

.card-header .col-auto {
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .card-header .col-auto .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 768px) {
    .template-card {
        margin-bottom: 1rem;
    }

    .template-stats .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }

    .quick-template-btn {
        margin-bottom: 0.5rem;
    }

    .section {
        padding: 1rem;
    }

    .checklist-items-container {
        max-height: 300px;
    }
}

@media (max-width: 576px) {
    .template-card .btn-group {
        flex-direction: column;
    }

    .template-card .btn-group .btn {
        margin-bottom: 0.25rem;
    }

    .template-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .template-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .btn-group,
    .dropdown,
    .modal {
        display: none !important;
    }
}

/* ========== ACCESSIBILITY ========== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.checklist-item:focus-within {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

.quick-template-btn:focus,
.template-card:focus-within {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .template-card {
        border-width: 2px;
    }

    .checklist-item {
        border-width: 2px;
    }

    .progress-template {
        border: 2px solid;
    }
}