/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0f0a1e 0%, #1e1040 100%);
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #3b0764 0%, #1e0a3c 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(59, 7, 100, 0.6);
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Container Styles */
.search-container,
.dashboard-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    gap: 2rem;
}

/* Sidebar Styles */
.sidebar {
    flex: 0 0 380px;
    background: linear-gradient(135deg, #f5f0ff 0%, #ede9f8 100%);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    height: fit-content;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #2d1556;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 1rem;
}

.sidebar label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #3b1a6b;
    font-size: 0.95rem;
}

.sidebar select,
.sidebar input {
    width: 100%;
    padding: 0.875rem;
    border: 1.5px solid #e2d9f3;
    border-radius: 10px;
    font-size: 0.95rem;
    background-color: #faf8ff;
    color: #1e1040;
    transition: all 0.3s ease;
    font-family: inherit;
}

.sidebar select:focus,
.sidebar input:focus {
    outline: none;
    border-color: #7c3aed;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.sidebar button {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 10px 25px rgba(109, 40, 217, 0.4);
}

.sidebar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(109, 40, 217, 0.55);
}

.sidebar button:active {
    transform: translateY(0);
}

/* Search Type Group */
.search-type-group {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1.5px solid #ede9f8;
}

.search-type-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    color: #3b1a6b;
    transition: color 0.2s ease;
}

.search-type-group label:hover {
    color: #7c3aed;
}

.search-type-group input[type="radio"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #7c3aed;
}

/* Search Fields */
.search-fields {
    display: none;
}

.search-fields.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Filter Styles */
.filter-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ede9f8;
}

.filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-group h4 {
    margin: 0 0 0.875rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: #7c3aed;
}

.filter-item {
    margin-bottom: 0.875rem;
}

.filter-item label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
    color: #3b1a6b;
    transition: color 0.2s ease;
}

.filter-item label:hover {
    color: #7c3aed;
}

.filter-item input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #7c3aed;
}

.filter-item input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border: 1.5px solid #e2d9f3;
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: #faf8ff;
    transition: all 0.2s ease;
}

.filter-item input[type="text"]:focus {
    outline: none;
    border-color: #7c3aed;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Grid Styles */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.grid-item {
    background: linear-gradient(135deg, #f5f0ff 0%, #ede9f8 100%);
    padding: 1.75rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    border: 1px solid rgba(167, 139, 250, 0.25);
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(109, 40, 217, 0.25);
    border-color: rgba(124, 58, 237, 0.3);
}

.grid-item h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2d1556;
    font-size: 1.2rem;
    font-weight: 700;
}

.grid-item p {
    color: #4a3570;
    line-height: 1.7;
    margin: 0.75rem 0;
    font-size: 0.95rem;
}

.grid-item .attribute-tag {
    display: inline-block;
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.35rem 0.35rem 0.35rem 0;
    letter-spacing: 0.5px;
}

/* Clickable attribute tags (link to a filtered search) */
.attribute-tag.attribute-link {
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.attribute-tag.attribute-link:hover {
    filter: brightness(1.18);
    box-shadow: 0 3px 12px rgba(109, 40, 217, 0.55);
    transform: translateY(-1px);
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 0.5rem;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 2rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1.5px solid rgba(239, 68, 68, 0.35);
    border-radius: 12px;
    font-size: 1rem;
    color: #fca5a5;
    font-weight: 500;
    margin: 1rem 0;
}

.error-message {
    background: rgba(239, 68, 68, 0.12);
    border: 1.5px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.no-results {
    text-align: center;
    padding: 2rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin: 1rem 0;
}

/* Login Page Specific */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0a0614 0%, #2d1556 50%, #0a0614 100%);
}

.user-action-container {
    background: rgba(30, 10, 60, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(109, 40, 217, 0.15);
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(167, 139, 250, 0.25);
}

.user-action-container h1 {
    text-align: center;
    margin: 0 0 1.75rem 0;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-action-container form {
    display: flex;
    flex-direction: column;
}

.user-action-container label {
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    letter-spacing: 0.25px;
}

.user-action-container input {
    padding: 0.875rem;
    margin-bottom: 1.1rem;
    border: 1.5px solid rgba(167, 139, 250, 0.2);
    border-radius: 10px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.07);
    color: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.user-action-container input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.user-action-container input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(124, 58, 237, 0.12);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.user-action-container button {
    padding: 0.9rem;
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(109, 40, 217, 0.45);
    margin-top: 0.5rem;
}

.user-action-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(109, 40, 217, 0.6);
}

.user-action-container button:active {
    transform: translateY(0);
}

.reset-link,
.create-account-link,
.log-credit-link {
    text-align: center;
    margin-top: 1rem;
}

.reset-link a,
.create-account-link a,
.log-credit-link a {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    font-size: 0.9rem;
}

.reset-link a:hover,
.create-account-link a:hover,
.log-credit-link a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

.create-account-link,
.log-credit-link {
    margin-top: 0.5rem;
}

/* Pagination Settings */
.pagination-settings {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1.5px solid #ede9f8;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pagination-settings label {
    font-weight: 600;
    color: #3b1a6b;
    font-size: 0.9rem;
}

.pagination-settings select {
    padding: 0.75rem;
    border: 1.5px solid #e2d9f3;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #faf8ff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pagination-settings select:hover {
    border-color: #7c3aed;
}

.pagination-settings select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(167, 139, 250, 0.12);
}

.pagination-btn {
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(109, 40, 217, 0.4);
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(109, 40, 217, 0.55);
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

.page-info {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    min-width: 120px;
    text-align: center;
}

/* Top Navigation Bar */
.topnav {
    background: linear-gradient(135deg, #1e0a3c 0%, #0f0720 100%);
    height: 60px;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(167, 139, 250, 0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav-center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.topnav-logo {
    display: block;
    height: 38px;
    width: auto;
}

.topnav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.3rem;
    justify-self: end;
}

.topnav-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.topnav-link i {
    font-size: 0.82rem;
}

.topnav-link:hover {
    background: rgba(167, 139, 250, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.topnav-link.active {
    background: rgba(109, 40, 217, 0.28);
    color: white;
    font-weight: 600;
}

.topnav-link.active i {
    color: #c4b5fd;
}

.login-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.login-logo svg {
    height: 56px;
    width: auto;
}

/* Responsive Design */
@media (max-width: 600px) {
    .topnav {
        padding: 0 1rem;
    }

    .topnav-logo {
        height: 28px;
    }

    .topnav-link span {
        display: none;
    }

    .topnav-link {
        padding: 0.45rem 0.7rem;
    }
}

@media (max-width: 768px) {
    .search-container,
    .dashboard-container {
        flex-direction: column;
        gap: 1rem;
    }

    .sidebar {
        flex: 0 0 auto;
    }

    .header h1 {
        font-size: 1.8rem;
    }

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

    body.login-page {
        height: auto;
        padding: 1rem;
    }

    .user-action-container {
        margin: 1rem;
        padding: 2rem;
    }

    .user-action-container h1 {
        font-size: 1.5rem;
    }
}
