/**
 * SICAKAP - Panduan Dispensasi Styles
 * Styling untuk halaman panduan/dokumentasi dispensasi
 */

/* ==================== PANDUAN PAGE CONTAINER ==================== */
#dispensasi-panduan {
    padding: 0rem;
}

#dispensasi-panduan h1 {
    margin-bottom: 1.5rem;
    color: #333;
}

/* ==================== PANDUAN NAVIGATION ==================== */
.panduan-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
    align-items: flex-start;
}

@media (max-width: 1024px) {
    .panduan-container {
        grid-template-columns: 1fr;
    }
    
    .panduan-nav {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

.panduan-nav {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 2rem) !important;
    overflow-y: auto !important;
    z-index: 100 !important;
}

.panduan-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #667eea;
}

.panduan-nav-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.panduan-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.panduan-nav-list li {
    margin-bottom: 0.25rem;
}

.panduan-nav-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.panduan-nav-list a:hover {
    background: #f0f4ff;
    color: #667eea;
}

.panduan-nav-list a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panduan-nav-list a i {
    width: 20px;
    text-align: center;
}

/* Download Button in Nav */
.panduan-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.panduan-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* ==================== PANDUAN CONTENT AREA ==================== */
.panduan-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 2rem;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.panduan-section {
    display: none;
    animation: fadeIn 0.3s ease;
    height: 100%;
}

.panduan-section.active {
    display: block !important;
    visibility: visible !important;
}

/* AI result section uses flex layout */
#panduan-ai-result.active {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

/* Regular sections (non-AI) are scrollable blocks */
.panduan-section:not(#panduan-ai-result).active {
    display: block !important;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* fadeIn keyframes defined in base.css */

/* For regular sections (non-AI), make them scrollable */
.panduan-section:not(#panduan-ai-result) {
    overflow-y: auto;
    padding-right: 0.5rem;
}

.panduan-section:not(#panduan-ai-result).active {
    display: block !important;
}

.panduan-section h2 {
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #667eea;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.panduan-section h2 i {
    color: #667eea;
}

.panduan-section h3 {
    color: #444;
    margin: 1.5rem 0 1rem;
    font-size: 1.1rem;
}

.panduan-section h4 {
    color: #555;
    margin: 1.25rem 0 0.75rem;
    font-size: 1rem;
}

.panduan-section p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.panduan-section ul, .panduan-section ol {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.panduan-section li {
    margin-bottom: 0.5rem;
}

/* ==================== INFO BOXES ==================== */
.info-box {
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.info-box i {
    font-size: 1.25rem;
    margin-top: 0.15rem;
}

.info-box-content {
    flex: 1;
}

.info-box-content strong {
    display: block;
    margin-bottom: 0.5rem;
}

.info-box.info {
    background: #e8f4fd;
    border-left: 4px solid #0ea5e9;
}

.info-box.info i {
    color: #0ea5e9;
}

.info-box.warning {
    background: #fef3cd;
    border-left: 4px solid #f59e0b;
}

.info-box.warning i {
    color: #f59e0b;
}

.info-box.success {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.info-box.success i {
    color: #10b981;
}

.info-box.danger {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.info-box.danger i {
    color: #ef4444;
}

/* ==================== STEP CARDS / DEFINITION LIST ==================== */
.step-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    margin: 1.5rem 0 !important;
    visibility: visible !important;
}

.step-card {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 0rem 1rem !important;
    padding: 1.25rem !important;
    background: white !important;
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
    border-left: 4px solid #667eea !important;
    transition: all 0.2s ease !important;
    min-height: auto !important;
    align-items: flex-start !important;
    visibility: visible !important;
}

.step-card:hover {
    background: #f8f9fa !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    grid-row: 1 / 3 !important;
    grid-column: 1 !important;
}

.step-content {
    flex: 1;
    min-width: 0;
    display: block;
    grid-column: 2 !important;
}

.step-content h4 {
    margin: 0 0 0.5rem 0 !important;
    color: #1a1a1a !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    display: block !important;
    visibility: visible !important;
    line-height: 1.3 !important;
    grid-row: 1 !important;
}

.step-content p {
    margin: 0 !important;
    color: #666 !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    display: block !important;
    visibility: visible !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    grid-row: 2 !important;
}

/* ==================== STATUS BADGES ==================== */
.status-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.status-table th,
.status-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.status-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.status-table tr:hover {
    background: #f8f9fa;
}

/* Status badge styles are defined in components.css */
/* Page-specific status badge variants for panduan */
.status-badge.pengajuan {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.terverifikasi {
    background: #d1fae5;
    color: #059669;
}

.status-badge.menunggu {
    background: #fef3cd;
    color: #d97706;
}

.status-badge.selesai {
    background: #d1fae5;
    color: #059669;
}

.status-badge.ditolak {
    background: #fee2e2;
    color: #dc2626;
}

/* ==================== DOCUMENT CHECKLIST ==================== */
.doc-checklist {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.doc-item:hover {
    background: #f0f4ff;
}

.doc-item i {
    color: #667eea;
    font-size: 1.1rem;
}

.doc-item span {
    flex: 1;
    color: #333;
}

.doc-item .doc-format {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: #e5e7eb;
    border-radius: 4px;
    color: #666;
}

/* ==================== LEGAL REFERENCES ==================== */
.legal-cards {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.legal-card {
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.legal-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.legal-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.legal-card-header i {
    color: #667eea;
    font-size: 1.25rem;
}

.legal-card-header h4 {
    margin: 0;
    color: #333;
    font-size: 1rem;
}

.legal-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ==================== WORKFLOW DIAGRAM ==================== */
.workflow-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    margin: 1.5rem 0;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    min-width: 100px;
}

.workflow-step .step-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.workflow-step.kecamatan .step-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.workflow-step.dinas .step-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.workflow-step.complete .step-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.workflow-step .step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.workflow-step .step-role {
    font-size: 0.7rem;
    color: #666;
}

.workflow-arrow {
    font-size: 1.5rem;
    color: #667eea;
}

/* ==================== FAQ ACCORDION ==================== */
.faq-list {
    margin: 1.5rem 0;
}

.faq-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: #f0f4ff;
}

.faq-question i {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question {
    background: #667eea;
    color: white;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 1.25rem;
    max-height: 500px;
}

.faq-answer p {
    margin: 0;
    color: #555;
    line-height: 1.7;
}

/* ==================== ROLE COMPARISON TABLE ==================== */
.role-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.role-table th,
.role-table td {
    padding: 0.875rem;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.role-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.role-table th:first-child,
.role-table td:first-child {
    text-align: left;
}

.role-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.role-table tbody tr:hover {
    background: #f0f4ff;
}

.role-table .check {
    color: #10b981;
    font-size: 1.1rem;
}

.role-table .cross {
    color: #ef4444;
    font-size: 1.1rem;
}

/* ==================== KEYBOARD SHORTCUTS ==================== */
.shortcut-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.shortcut-key {
    display: flex;
    gap: 0.25rem;
}

.shortcut-key kbd {
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.shortcut-desc {
    color: #555;
    font-size: 0.9rem;
}

/* ==================== CONTACT CARD ==================== */
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.contact-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.contact-card i {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.contact-card h4 {
    margin: 0 0 0.5rem;
    color: #333;
}

.contact-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.contact-card a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.contact-card a:hover {
    text-decoration: underline;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .panduan-nav {
        display: none;
    }
    
    .panduan-container {
        grid-template-columns: 1fr;
    }
    
    .panduan-section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .panduan-content {
        box-shadow: none;
    }
}

/* ==================== AI SEARCH RESULT - GEMINI STYLE ==================== */

/* User Message Style - Right Aligned */
.ai-user-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 0;
}

.ai-user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    order: 2;
}

.ai-user-query {
    max-width: 70%;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    color: white;
    font-size: 1rem;
    line-height: 1.5;
    order: 1;
}

/* AI Response Wrapper - Left Aligned */
.ai-response-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    min-height: 250px;
}

.ai-gemini-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #f3f0ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* AI Response Container */
.ai-response-container {
    flex: 1;
    background: #fff;
    border-radius: 18px;
    border-top-left-radius: 4px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    min-height: 250px;
}

/* AI Result Content */
.ai-result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100% !important;
}

.ai-result-text {
    color: #1a1a1a;
    font-size: 1rem;
    line-height: 1.85;
}

/* AI Response Text Formatting */
.ai-result-text .ai-paragraph {
    margin-bottom: 1rem;
    color: #333;
}

.ai-result-text .ai-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.ai-result-text .ai-heading:first-child {
    margin-top: 0;
}

.ai-result-text .ai-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 1rem 0;
}

.ai-result-text .ai-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
    line-height: 1.7;
    color: #444;
}

.ai-result-text .ai-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 6px;
    height: 6px;
    background: #8B5CF6;
    border-radius: 50%;
}

.ai-result-text strong {
    color: #1a1a1a;
    font-weight: 600;
}

.ai-result-text em {
    color: #555;
    font-style: italic;
}

/* Panduan Reference Links */
.panduan-reference-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panduan-reference-link:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
    text-decoration: underline;
}

/* AI Disclaimer */
.ai-disclaimer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
}

.ai-disclaimer i {
    font-size: 0.8rem;
}

/* AI Input Container - Bottom Fixed Style */
.ai-input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 28px;
    border: 1px solid #e5e7eb;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.ai-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #fff;
}

.ai-input-container input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 1rem;
    color: #333;
    outline: none;
}

.ai-input-container input::placeholder {
    color: #9ca3af;
}

.ai-send-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-send-btn:active {
    transform: scale(0.98);
}

/* Responsive for AI section */
@media (max-width: 768px) {
    .ai-chat-container {
        min-height: 300px;
    }
    
    .ai-user-message {
        gap: 0.5rem;
    }
    
    .ai-user-avatar,
    .ai-gemini-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .ai-user-query {
        max-width: 85%;
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .ai-response-container {
        padding: 1rem;
        min-height: 150px;
    }
    
    .ai-input-container {
        padding: 0.75rem;
    }
    
    .ai-send-btn {
        width: 38px;
        height: 38px;
    }
}

/* AI Chat Loading Indicator */
.ai-chat-loading {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
}

.ai-loading-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ai-loading-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8B5CF6 0%, #A855F7 100%);
    border-radius: 50%;
    color: white;
}

.ai-loading-avatar svg {
    width: 20px;
    height: 20px;
}

.ai-loading-content {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

/* Typing Indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

.ai-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* AI Chat Container - Fill Available Space */
.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 500px;
    overflow-y: auto;
    padding: 1.5rem 0;
}

/* Smaller Action Buttons - Positioned at the Bottom */
.ai-response-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: auto; /* Pushes the actions to the bottom */
    border-top: 1px solid #f0f0f0;
    padding-top: 0.5rem; /* Adds spacing between content and border-top */
}

.ai-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.ai-action-btn:hover {
    background: #f0f4ff;
    color: #667eea;
}
