/* Shadcn-inspired Design System */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
    --klikdex-red: #d44028;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #e5d1a2;
    background-image: linear-gradient(135deg, #e5d1a2 0%, #afb8ca 100%);
    min-height: 100vh;
    padding: 20px;
    color: hsl(var(--foreground));
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: hsl(var(--card));
    border-radius: calc(var(--radius) * 2);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
}

header {
    background: linear-gradient(135deg, #e5d1a2 0%, #afb8ca 100%);
    color: hsl(var(--primary-foreground));
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

header h1 .by-klikdex {
    font-size: 0.4em;
    font-weight: 400;
    vertical-align: middle;
    opacity: 0.9;
}

header h1 .klikdex-brand {
    color: var(--klikdex-red);
    font-weight: 600;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

.search-section {
    padding: 2rem;
}

.search-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    border-bottom: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: calc(var(--radius) - 2px);
    position: relative;
}

.tab-btn:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}

.tab-btn.active {
    color: hsl(var(--primary));
    border-bottom-color: hsl(var(--primary));
    background: hsl(var(--accent));
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes fadeOut {
    from { 
        opacity: 1; 
    }
    to { 
        opacity: 0; 
    }
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-group input[type="text"]:hover,
.form-group input[type="date"]:hover,
.form-group select:hover {
    border-color: hsl(var(--input));
}

.form-group small {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s;
}

.checkbox-group label:hover {
    background: hsl(var(--accent));
}

.checkbox-group input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: hsl(var(--primary));
}

.btn-primary {
    padding: 0.625rem 1.5rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    align-self: flex-start;
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.results-section {
    padding: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.results-info {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    padding: 0.5rem 1rem;
    background: hsl(var(--muted));
    border-radius: var(--radius);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    padding: 1.25rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-item:hover {
    border-color: hsl(var(--ring));
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

.result-item h3 {
    color: hsl(var(--primary));
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.result-item .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.813rem;
    color: hsl(var(--muted-foreground));
}

.result-item .meta span {
    background: hsl(var(--muted));
    padding: 0.25rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--border));
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 0.875rem;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover:not(:disabled) {
    border-color: hsl(var(--ring));
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.pagination span {
    color: hsl(var(--muted-foreground));
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
}

.pagination-ellipsis {
    color: hsl(var(--muted-foreground));
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    user-select: none;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 3px solid hsl(var(--muted));
    border-top: 3px solid hsl(var(--primary));
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.25rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1.25rem 2rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow: auto;
    animation: fadeIn 0.2s;
}

.modal-content {
    background-color: hsl(var(--card));
    margin: 5% auto;
    padding: 0;
    border-radius: calc(var(--radius) * 2);
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    border: 1px solid hsl(var(--border));
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.close {
    color: hsl(var(--muted-foreground));
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.close:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.document-content {
    line-height: 1.75;
    color: hsl(var(--foreground));
}

.document-content p {
    margin-bottom: 1rem;
}

footer {
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.3);
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

footer p {
    margin: 0;
}

.klikdex-link {
    color: var(--klikdex-red);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.klikdex-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 0.75rem;
    }

    header {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.875rem;
    }

    .search-section {
        padding: 1.5rem 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .search-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .results-section {
        padding: 1.5rem 1rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-header,
    .modal-body {
        padding: 1.25rem;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}
