/* ========================================
   RinSearch - Cute Aqua Theme
   ======================================== */

:root {
    --primary: #7dd3fc;
    --primary-light: #bae6fd;
    --primary-dark: #38bdf8;
    --primary-darker: #0ea5e9;
    --accent: #f0abfc;
    --accent-light: #f5d0fe;
    --background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 50%, #fce7f3 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 8px 32px rgba(125, 211, 252, 0.3);
    --text: #334155;
    --text-light: #64748b;
    --border-radius: 20px;
    --border-radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

/* Background Decorations */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(125, 211, 252, 0.3), rgba(240, 171, 252, 0.2));
    animation: float 20s ease-in-out infinite;
}

.bubble-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation-delay: 0s; }
.bubble-2 { width: 200px; height: 200px; top: 50%; right: -50px; animation-delay: -5s; }
.bubble-3 { width: 150px; height: 150px; bottom: 10%; left: 10%; animation-delay: -10s; }
.bubble-4 { width: 100px; height: 100px; top: 30%; left: 20%; animation-delay: -3s; }
.bubble-5 { width: 80px; height: 80px; bottom: 20%; right: 20%; animation-delay: -7s; }

.star {
    position: absolute;
    font-size: 24px;
    color: var(--primary-dark);
    animation: twinkle 2s ease-in-out infinite;
    opacity: 0.6;
}

.star-1 { top: 15%; left: 15%; animation-delay: 0s; }
.star-2 { top: 25%; right: 20%; animation-delay: 0.5s; }
.star-3 { bottom: 30%; left: 25%; animation-delay: 1s; }

.cloud {
    position: absolute;
    left: -120px;
    font-size: 60px;
    color: rgba(255, 255, 255, 0.8);
    animation: cloudFloat 30s linear infinite;
    will-change: transform;
}

.cloud-1 { top: 10%; animation-delay: 0s; }
.cloud-2 { top: 60%; animation-delay: -15s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -20px) rotate(5deg); }
    50% { transform: translate(-10px, 20px) rotate(-5deg); }
    75% { transform: translate(-20px, -10px) rotate(3deg); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes cloudFloat {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 240px)); }
}

@media (prefers-reduced-motion: reduce) {
    .bubble, .star, .cloud, .logo-icon, .logo-sparkle, .btn-sparkle, .empty-icon {
        animation: none !important;
    }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 40px;
    animation: bounce 2s ease-in-out infinite;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-darker), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sparkle {
    font-size: 30px;
    animation: twinkle 1.5s ease-in-out infinite;
}

.tagline {
    color: var(--text-light);
    font-size: 1.1rem;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.tab:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}

.tab-icon {
    font-size: 1.2rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Search Box */
.search-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
}

.search-type-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-type {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary-light);
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-light);
    transition: var(--transition);
}

.search-type:hover {
    border-color: var(--primary);
    color: var(--primary-darker);
}

.search-type.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary-dark);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 8px 8px 20px;
    border-radius: 50px;
    border: 2px solid var(--primary-light);
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.3);
}

.search-icon {
    font-size: 1.4rem;
}

.search-input-wrapper input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1.1rem;
    background: transparent;
    color: var(--text);
}

.search-input-wrapper input::placeholder {
    color: var(--text-light);
}

.clear-btn {
    background: var(--primary-light);
    color: var(--primary-darker);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.clear-btn:hover {
    background: var(--primary);
    color: white;
}

.clear-btn.hidden {
    display: none;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}

.btn-sparkle {
    animation: twinkle 1s ease-in-out infinite;
}

/* Results */
.results {
    min-height: 200px;
}

.results-summary {
    margin-bottom: 20px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.result-card {
    background: var(--card-bg);
    padding: 20px 25px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(125, 211, 252, 0.15);
    backdrop-filter: blur(10px);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.result-card:hover {
    transform: translateX(5px);
    box-shadow: var(--card-shadow);
    border-left-color: var(--accent);
}

.result-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-darker);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-title::before {
    content: '🌸';
    font-size: 1rem;
}

.result-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.result-title a:hover {
    color: var(--accent);
}

.result-title mark,
.result-snippet mark {
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    padding: 1px 4px;
    border-radius: 4px;
    color: inherit;
}

.result-url {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    word-break: break-all;
}

.result-snippet {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.6;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
}

.page-btn {
    padding: 10px 20px;
    background: var(--card-bg);
    border: 2px solid var(--primary-light);
    border-radius: 50px;
    color: var(--primary-darker);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary-dark);
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Image Results Grid */
.image-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.image-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(125, 211, 252, 0.15);
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
}

.image-card-img {
    cursor: pointer;
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    display: block;
}

.image-card-info {
    padding: 10px;
}

.image-card-title {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.image-card-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary-darker);
    text-decoration: none;
    padding: 4px 8px;
    background: var(--primary-light);
    border-radius: 20px;
    transition: var(--transition);
}

.image-card-link:hover {
    background: var(--primary);
    color: white;
}

/* Video Results Grid */
.video-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(125, 211, 252, 0.15);
    transition: var(--transition);
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    overflow: hidden;
    cursor: pointer;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    transition: var(--transition);
}

.video-card:hover .video-play-icon {
    background: var(--primary-darker);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-platform {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    font-size: 0.75rem;
    color: white;
}

.video-card-info {
    padding: 15px;
}

.video-card-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card-title a {
    color: inherit;
    text-decoration: none;
}

.video-card-title a:hover {
    color: var(--primary-darker);
}

.video-card-source {
    font-size: 0.8rem;
    color: var(--text-light);
}

.video-card-source a {
    color: var(--primary-darker);
    text-decoration: none;
}

.video-card-source a:hover {
    text-decoration: underline;
}

.video-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: min(860px, 95vw);
}

.video-modal-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-player iframe,
.video-modal-player video {
    width: 100%;
    height: 100%;
    border: none;
}

.video-modal-fallback {
    color: white;
    padding: 24px;
    text-align: center;
    font-size: 0.95rem;
}

.video-modal-title {
    color: white;
    font-size: 1.05rem;
    text-align: center;
}

.video-modal-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex-direction: column;
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 90%;
    max-height: 90%;
}

.image-modal img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--border-radius-sm);
}

.image-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.image-modal-link:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: scale(1.05);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
}

/* Add Site Form */
.add-site-form {
    background: var(--card-bg);
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
}

.add-site-form h2 {
    font-size: 1.5rem;
    color: var(--primary-darker);
    margin-bottom: 10px;
    text-align: center;
}

.form-description {
    color: var(--text-light);
    margin-bottom: 25px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.label-icon {
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--primary-light);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: white;
    color: var(--text);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.2);
}

.add-site-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50px;
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.add-site-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(125, 211, 252, 0.5);
}

.add-site-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.3rem;
}

.add-site-status {
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
}

.add-site-status.hidden {
    display: none;
}

.add-site-status.success {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(16, 185, 129, 0.1));
    color: #059669;
}

.add-site-status.error {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.1));
    color: #dc2626;
}

.add-site-status.warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
    color: #d97706;
}

.add-site-status.loading {
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    color: var(--text);
}

/* Index Stats & Registered Sites */
.index-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed var(--primary-light);
    text-align: center;
}

.index-stats-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.index-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-light), white);
    border-radius: 50px;
    font-size: 0.95rem;
    color: var(--text);
}

.index-stat .stat-icon {
    font-size: 1.2rem;
}

.sites-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 2px dashed var(--primary-light);
}

.sites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sites-header h3 {
    font-size: 1.1rem;
    color: var(--primary-darker);
}

.refresh-mini-btn {
    padding: 6px 14px;
    background: white;
    border: 1.5px solid var(--primary-light);
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--primary-darker);
    cursor: pointer;
    transition: var(--transition);
}

.refresh-mini-btn:hover {
    background: var(--primary-light);
}

.sites-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sites-empty {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 12px;
}

.site-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1.5px solid var(--primary-light);
    border-radius: var(--border-radius-sm);
}

.site-main {
    min-width: 0;
    flex: 1;
}

.site-url {
    display: block;
    font-weight: 500;
    color: var(--primary-darker);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-url:hover {
    text-decoration: underline;
}

.site-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.site-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-darker);
}

.site-status-badge.crawling,
.site-status-badge.queued {
    background: #fef3c7;
    color: #d97706;
}

.site-status-badge.idle {
    background: #d1fae5;
    color: #059669;
}

.site-status-badge.error {
    background: #fee2e2;
    color: #dc2626;
}

.site-action-btn {
    background: #f8fafc;
    border: 1px solid var(--primary-light);
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.site-action-btn:hover:not(:disabled) {
    background: var(--primary-light);
}

.site-action-btn.delete:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
}

.site-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px 20px;
    color: var(--text-light);
}

.footer p {
    margin-bottom: 5px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
    .logo h1 {
        font-size: 2rem;
    }

    .search-input-wrapper {
        flex-direction: column;
        padding: 15px;
        border-radius: var(--border-radius);
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .tab {
        justify-content: center;
    }

    .site-item {
        flex-direction: column;
        align-items: flex-start;
    }
}
