/* --- HSN App Container --- */
.hsn-app-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    line-height: 1.5;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Search Section --- */
.hsn-search-section {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
    text-align: center;
}

.hsn-search-title {
    color: white;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    margin-top: 0;
}

.hsn-search-subtitle {
    color: #e0e7ff;
    margin-bottom: 25px;
    font-size: 1rem;
}

.hsn-search-form {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.hsn-search-input {
    width: 100%;
    padding: 16px 20px;
    padding-right: 120px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-size: 16px;
    outline: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.hsn-search-input:focus {
    border-color: #818cf8;
}

.hsn-search-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.hsn-search-btn:hover {
    background-color: #3730a3;
}

/* --- Global Utility Bar --- */
.hsn-utility-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 25px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.hsn-util-btn {
    background: white;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.hsn-util-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #f5f3ff;
}

/* --- Breadcrumbs --- */
.hsn-breadcrumbs {
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #64748b;
}

.hsn-breadcrumbs a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.hsn-breadcrumbs a:hover {
    color: #4f46e5;
}

.hsn-breadcrumbs .separator {
    margin: 0 8px;
    color: #cbd5e1;
}

.hsn-breadcrumbs .current {
    font-weight: 600;
    color: #4f46e5;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- Content Cards --- */
.hsn-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 30px;
}

.hsn-card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hsn-card-body {
    padding: 25px;
}

/* --- List/Grid Design --- */
.hsn-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hsn-link-block {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.hsn-link-block:hover {
    border-color: #818cf8;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
}

.hsn-code-badge {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 800;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.hsn-link-block:hover .hsn-code-badge {
    background-color: #4f46e5;
    color: white;
}

.hsn-link-content {
    padding-right: 30px;
    width: 100%;
}

.hsn-link-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.05rem;
    color: #1e293b;
    line-height: 1.4;
}

.hsn-link-content p {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Count Meta Info */
.hsn-meta-count {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* --- ACCORDION STYLES (New) --- */
.hsn-accordion-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.hsn-accordion-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.hsn-accordion-header {
    padding: 16px 20px;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.hsn-accordion-header:hover {
    background: #f1f5f9;
}

.hsn-accordion-header.active {
    background: #eef2ff;
    border-bottom-color: #e2e8f0;
}

.hsn-accordion-header.active .hsn-acc-icon {
    transform: rotate(180deg);
}

.hsn-acc-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hsn-acc-desc {
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
}

.hsn-acc-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hsn-badge-count {
    background: #e2e8f0;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.hsn-acc-icon {
    color: #94a3b8;
    transition: transform 0.3s;
}

.hsn-accordion-content {
    display: none;
    border-top: 1px solid #e2e8f0;
}

/* --- Detail Page Specifics --- */
.hsn-detail-header {
    background: linear-gradient(to right, #1e293b, #334155);
    color: white;
    padding: 40px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.hsn-detail-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.hsn-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.hsn-action-btn:hover {
    background: white;
    color: #334155;
}

.hsn-big-code {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 10px 0;
    font-family: monospace;
    letter-spacing: -1px;
}

.hsn-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.hsn-desc-box {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #1e293b;
    border-left: 4px solid #4f46e5;
    padding-left: 20px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 0 8px 8px 0;
}

.hsn-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.hsn-meta-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.hsn-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 5px;
}

.hsn-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

/* --- Hierarchy Tree --- */
.hsn-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hsn-tree-item {
    padding-left: 20px;
    border-left: 2px solid #e2e8f0;
    position: relative;
    padding-bottom: 20px;
}

.hsn-tree-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid white;
}

.hsn-tree-item.active {
    border-left-color: #4f46e5;
}

.hsn-tree-item.active::before {
    background: #4f46e5;
}

/* --- Tables --- */
.hsn-table-responsive {
    overflow-x: auto;
}

.hsn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.hsn-table th {
    background-color: #f8fafc;
    text-align: left;
    padding: 12px 20px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.hsn-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.hsn-table tr:last-child td {
    border-bottom: none;
}

.hsn-table tr:hover {
    background-color: #f8fafc;
}

.hsn-tag {
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-family: monospace;
}

.hsn-btn-sm {
    display: inline-block;
    padding: 6px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.hsn-btn-sm:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .hsn-detail-grid { grid-template-columns: 1fr; }
    .hsn-search-input { padding-right: 20px; margin-bottom: 10px; }
    .hsn-search-btn { position: static; width: 100%; padding: 12px; margin-top: 10px; }
    .hsn-grid { grid-template-columns: 1fr; }
    .hsn-detail-actions { position: relative; top: 0; right: 0; margin-bottom: 15px; justify-content: center;}
    .hsn-acc-title { flex-direction: column; align-items: flex-start; gap: 5px; }
}

/* PRINT STYLES - Hides header/footer data */
@media print {
    /* Set page margins to remove default browser headers/footers */
    @page { margin: 1cm; size: auto; }
    
    /* Hide navigational elements */
    .hsn-search-section, 
    .hsn-utility-bar, 
    .hsn-breadcrumbs, 
    .hsn-action-btn,
    .hsn-btn-sm { 
        display: none !important; 
    }

    /* Adjust container */
    .hsn-app-wrapper { 
        max-width: 100%; 
        padding: 0; 
        width: 100%;
    }
    
    .hsn-card, .hsn-accordion-item { 
        box-shadow: none; 
        border: 1px solid #ccc; 
        break-inside: avoid;
    }
    
    .hsn-accordion-content {
        display: block !important; /* Always expand in print */
        border-top: 1px solid #ccc;
    }
    
    .hsn-acc-icon { display: none; }

    /* Ensure text is black for printing */
    body { color: black; }
    a { text-decoration: none; color: black; }
}