/* ============================================
   TEMPLATES & CHECKLISTS - Wabi-Sabi Design
   boardr.it Application
   ============================================ */

/* ========== TEMPLATE CARDS ========== */

.template-card {
    background: var(--washi-white);
    border: none;
    border-radius: var(--radius-organic-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--duration-slow) var(--ease-gentle);
}

.template-card .card-text {
    text-decoration: none !important;
    color: var(--sumi-light);
}

.template-card:hover .card-text {
    text-decoration: none !important;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lifted);
}

.template-card .card-header {
    background: var(--washi-warm);
    border-bottom: 1px dashed var(--washi-shadow);
    transition: all var(--duration-base) var(--ease-gentle);
    padding: var(--space-5) var(--space-6);
}

.template-card:hover .card-header {
    background: var(--matcha-whisper);
}

.template-card .card-body {
    padding: var(--space-5) var(--space-6);
}

.template-preview {
    position: relative;
}

/* ========== CHECKLIST STYLES ========== */

.checklist-items-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: var(--space-2);
}

.checklist-items-container::-webkit-scrollbar {
    width: 6px;
}

.checklist-items-container::-webkit-scrollbar-track {
    background: var(--washi-aged);
    border-radius: var(--radius-full);
}

.checklist-items-container::-webkit-scrollbar-thumb {
    background: var(--sumi-ghost);
    border-radius: var(--radius-full);
}

.checklist-items-container::-webkit-scrollbar-thumb:hover {
    background: var(--sumi-whisper);
}

.checklist-item {
    background: var(--washi-white);
    border: 1px solid var(--washi-shadow);
    border-radius: var(--radius-organic-sm);
    transition: all var(--duration-base) var(--ease-gentle);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.checklist-item:hover {
    box-shadow: var(--shadow-paper);
    border-color: var(--matcha-faded);
}

.checklist-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.checklist-item-placeholder {
    background: var(--matcha-whisper);
    border: 2px dashed var(--matcha-faded);
    border-radius: var(--radius-organic-sm);
    margin: var(--space-2) 0;
    animation: gentlePulse 2s infinite;
}

@keyframes gentlePulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.drag-handle {
    cursor: grab;
    color: var(--sumi-ghost);
    transition: all var(--duration-base) var(--ease-gentle);
    padding: var(--space-2);
}

.drag-handle:hover {
    color: var(--matcha-primary);
    transform: scale(1.1);
}

.drag-handle:active {
    cursor: grabbing;
    transform: scale(1.05);
}

/* ========== EMPTY STATES ========== */

.empty-state {
    padding: var(--space-12) var(--space-8);
    text-align: center;
    color: var(--sumi-faded);
    background: var(--washi-warm);
    border: 2px dashed var(--washi-shadow);
    border-radius: var(--radius-organic-lg);
    transition: all var(--duration-slow) var(--ease-gentle);
}

.empty-state:hover {
    border-color: var(--matcha-faded);
    background: var(--matcha-whisper);
}

.empty-state i {
    font-size: 3rem;
    color: var(--matcha-light);
    opacity: 0.6;
    transition: all var(--duration-slow) var(--ease-gentle);
}

.empty-state:hover i {
    transform: scale(1.1);
    opacity: 1;
    color: var(--matcha-primary);
}

.empty-state h4 {
    font-family: var(--font-display);
    color: var(--matcha-primary);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--sumi-faded);
}

/* ========== QUICK TEMPLATE BUTTONS ========== */

.quick-template-btn {
    position: relative;
    overflow: hidden;
    transition: all var(--duration-base) var(--ease-gentle);
    background: var(--washi-white);
    border: 1px solid var(--washi-shadow);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-5);
    color: var(--sumi-light);
}

.quick-template-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--matcha-whisper);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width var(--duration-slow) var(--ease-gentle),
                height var(--duration-slow) var(--ease-gentle);
}

.quick-template-btn:hover::before {
    width: 300px;
    height: 300px;
}

.quick-template-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: var(--matcha-faded);
    color: var(--matcha-dark);
}

/* ========== TEMPLATE STATS ========== */

.template-stats .badge {
    font-size: var(--text-xs);
    padding: var(--space-1-5) var(--space-3);
    border-radius: var(--radius-full);
    font-weight: var(--font-medium);
    background: var(--washi-aged);
    color: var(--sumi-faded);
}

.template-stats .badge.bg-success {
    background: var(--matcha-whisper) !important;
    color: var(--matcha-dark) !important;
}

.template-stats .badge.bg-warning {
    background: var(--kitsune-whisper) !important;
    color: var(--kitsune-dark) !important;
}

.template-stats .badge.bg-info {
    background: var(--ai-whisper) !important;
    color: var(--ai-dark) !important;
}

/* ========== PROGRESS INDICATORS ========== */

.progress-template {
    height: 6px;
    background: var(--washi-aged);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-template .progress-bar {
    background: linear-gradient(90deg, var(--matcha-faded), var(--matcha-primary));
    transition: width var(--duration-slow) var(--ease-organic);
    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-organic-lg);
    box-shadow: var(--shadow-floating);
    background: var(--washi-white);
}

.modal-header {
    border-bottom: 1px dashed var(--washi-shadow);
    background: var(--washi-warm);
    padding: var(--space-5) var(--space-6);
}

.modal-header .modal-title {
    font-family: var(--font-display);
    color: var(--sumi-dark);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    border-top: 1px dashed var(--washi-shadow);
    background: var(--washi-warm);
    padding: var(--space-4) var(--space-6);
}

/* ========== 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.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.template-card {
    animation: fadeIn var(--duration-slow) var(--ease-gentle);
}

.checklist-item {
    animation: slideIn var(--duration-base) var(--ease-gentle);
}

/* ========== NOTIFICATION STYLES ========== */

.template-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-notification);
    min-width: 300px;
    border-radius: var(--radius-organic-lg);
    box-shadow: var(--shadow-floating);
    animation: slideInRight var(--duration-base) var(--ease-gentle);
    border: 1px dashed var(--washi-shadow);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== SECTION STYLES ========== */

.section {
    background: var(--washi-white);
    border: 1px solid var(--washi-shadow);
    border-radius: var(--radius-organic-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--hanko-primary);
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-gentle);
}

.section:hover::before {
    opacity: 0.6;
}

.section-title {
    font-family: var(--font-display);
    color: var(--sumi-medium);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-title i {
    color: var(--hanko-primary);
    opacity: 0.7;
}

/* ========== CHECKLIST ITEM STATES ========== */

.checklist-item-completed {
    opacity: 0.7;
    background: var(--matcha-whisper);
}

.checklist-item-completed .form-control {
    text-decoration: line-through;
    color: var(--sumi-faded);
}

.checklist-item-required {
    border-left: 3px solid var(--kitsune-primary);
}

/* ========== TEMPLATE DETAILS HEADER BUTTONS ========== */

.card-header .col-auto {
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .card-header .col-auto .btn {
        padding: var(--space-1-5) var(--space-2-5);
        font-size: var(--text-xs);
    }
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 768px) {
    .template-card {
        margin-bottom: var(--space-4);
    }

    .template-stats .badge {
        font-size: 0.65rem;
        padding: var(--space-1) var(--space-2);
    }

    .quick-template-btn {
        margin-bottom: var(--space-2);
    }

    .section {
        padding: var(--space-4);
    }

    .checklist-items-container {
        max-height: 300px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-4);
    }
}

@media (max-width: 576px) {
    .template-card .btn-group {
        flex-direction: column;
    }

    .template-card .btn-group .btn {
        margin-bottom: var(--space-1);
    }

    .template-stats {
        flex-direction: column;
        gap: var(--space-2);
    }

    .empty-state {
        padding: var(--space-8) var(--space-4);
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .template-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--sumi-medium);
    }

    .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: none;
    box-shadow: var(--shadow-focus);
}

.quick-template-btn:focus,
.template-card:focus-within {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .template-card {
        border-width: 2px;
        border-color: var(--sumi-medium);
    }

    .checklist-item {
        border-width: 2px;
    }

    .progress-template {
        border: 2px solid var(--sumi-medium);
    }
}
