/* ==========================================
   FILE: css/components/templates.css
   ✅ PRODUCTION-READY - Professional Template Styling
   ========================================== */

/* ===== Template Container ===== */
#templates-container {
    animation: fadeIn 0.3s ease-in;
}

#templates-container .card {
    border: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

#templates-container .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* ===== Template Cards (Grid View) ===== */
#templates-container .card.h-100 {
    height: 100% !important;
    display: flex;
    flex-direction: column;
}

#templates-container .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#templates-container .flex-grow-1 {
    flex-grow: 1 !important;
}

/* ===== Status Border Colors ===== */
#templates-container .border-success {
    border-left-width: 4px !important;
    border-left-color: #059669 !important;
}

#templates-container .border-secondary {
    border-left-width: 4px !important;
    border-left-color: #6b7280 !important;
}

/* ===== Badges ===== */
#templates-container .badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
}

#templates-container .badge.bg-info {
    background-color: #0284c7 !important;
}

/* ===== Filters Section ===== */
#templates-container .card-body.border-bottom {
    background-color: #f9fafb;
}

#templates-container .input-group {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#templates-container .input-group-text {
    background-color: white;
    border-right: none;
}

#templates-container #searchTemplates {
    border-left: none;
}

#templates-container #searchTemplates:focus {
    border-color: #ced4da;
    box-shadow: none;
}

/* ===== Button Groups ===== */
#templates-container .btn-group {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#templates-container .btn-group .btn {
    transition: all 0.2s ease;
}

#templates-container .btn-group .btn:hover {
    transform: translateY(-1px);
}

/* ===== Action Buttons ===== */
#templates-container .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

#templates-container .btn-outline-primary:hover {
    background-color: #1e3a8a;
    border-color: #1e3a8a;
    color: white;
}

#templates-container .btn-outline-success:hover {
    background-color: #059669;
    border-color: #059669;
    color: white;
}

#templates-container .btn-outline-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: white;
}

#templates-container .btn-outline-info:hover {
    background-color: #0284c7;
    border-color: #0284c7;
    color: white;
}

/* ===== List View ===== */
#templates-container .list-group-item {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

#templates-container .list-group-item:hover {
    background-color: #f9fafb;
    padding-left: 1.5rem;
}

#templates-container .list-group-item:last-child {
    border-bottom: none;
}

/* ===== Empty State ===== */
#templates-container .text-center.py-5 i {
    opacity: 0.3;
}

/* ===== Loading Placeholders ===== */
#templates-container .placeholder {
    background-color: #e5e7eb;
    border-radius: 0.25rem;
}

#templates-container .placeholder-glow .placeholder {
    animation: placeholder-glow 2s ease-in-out infinite;
}

@keyframes placeholder-glow {
    50% {
        opacity: 0.5;
    }
}

/* ===== Breadcrumb ===== */
#templates-container .breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

#templates-container .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
}

#templates-container .breadcrumb-item a {
    text-decoration: none;
    color: #6b7280;
}

#templates-container .breadcrumb-item a:hover {
    color: #1e3a8a;
}

/* ===== SweetAlert2 Customizations ===== */
.swal2-popup {
    border-radius: 0.5rem;
}

.swal2-popup .form-control,
.swal2-popup .form-select {
    border-radius: 0.375rem;
}

.swal2-popup .font-monospace {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.swal2-popup .variable-btn {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.swal2-popup .variable-btn:hover {
    background-color: #1e3a8a;
    color: white;
    border-color: #1e3a8a;
    transform: translateY(-1px);
}

/* ===== Accordion in Help Guide ===== */
.accordion-button {
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: #e0e7ff;
    color: #1e3a8a;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: #e5e7eb;
}

/* ===== Responsive Design ===== */

/* Tablet (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    #templates-container .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    #templates-container .d-sm-flex.flex-wrap {
        flex-direction: column;
        gap: 1rem !important;
    }
    
    #templates-container .card-header .d-flex {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    #templates-container .card-body.border-bottom .row {
        gap: 1rem;
    }
    
    #templates-container .col-md-4,
    #templates-container .col-md-3,
    #templates-container .col-md-2 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    #templates-container .btn-group.w-100 {
        display: flex;
    }
    
    #templates-container .btn-group .btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    /* List view on mobile */
    #templates-container .list-group-item .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    #templates-container .list-group-item .col-md-6,
    #templates-container .list-group-item .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    #templates-container .list-group-item .text-end {
        text-align: left !important;
    }
}

/* Extra small mobile (< 576px) */
@media (max-width: 575px) {
    #templates-container h1.h3 {
        font-size: 1.5rem;
    }
    
    #templates-container .card-body {
        padding: 1rem;
    }
    
    #templates-container .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    #templates-container .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.5em;
    }
}

/* ===== Print Styles ===== */
@media print {
    #templates-container .card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    #templates-container .btn,
    #templates-container .card-header {
        display: none !important;
    }
}

/* ===== Accessibility ===== */
#templates-container .btn:focus,
#templates-container .form-control:focus,
#templates-container .form-select:focus {
    outline: 2px solid #1e3a8a;
    outline-offset: 2px;
}

/* ===== Smooth Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Dark Mode Support (Optional) ===== */
@media (prefers-color-scheme: dark) {
    #templates-container .card {
        background-color: #1f2937;
        color: #f3f4f6;
    }
    
    #templates-container .card-body.border-bottom {
        background-color: #111827;
    }
    
    #templates-container .text-muted {
        color: #9ca3af !important;
    }
    
    #templates-container .list-group-item:hover {
        background-color: #374151;
    }
}