:root {
    --bg: #0f1724;
    --card: #0b1220;
    --muted: #94a3b8;
    --accent: #7c3aed;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.04);
    --max-width: 1200px;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #071023 0%, #071428 100%);
    color: #e6eef8;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

.app {
    width: 100%;
    max-width: var(--max-width);
    padding: 20px;
}

/* AdSense Styles */
.ad-banner {
    width: 100%;
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    background: var(--glass);
    border: 1px dashed var(--glass-border);
    padding: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    border-radius: 8px;
}

.ad-top .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-mid .ad-placeholder {
    width: 336px;
    height: 280px;
    max-width: 100%;
}

.ad-bottom .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* Header */
header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    margin: 5px 0 0 0;
    color: var(--muted);
    font-size: 14px;
}

.header-right {
    margin-left: auto;
    text-align: right;
}

/* Search Section */
.search-section {
    margin-bottom: 20px;
}

.search-container {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 400px;
}

.search-input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: 12px;
    color: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: var(--muted);
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: inherit;
    font-family: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #5b21b6);
    border: none;
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.2);
    font-weight: 600;
}

.btn.primary:hover {
    box-shadow: 0 12px 35px rgba(124, 58, 237, 0.3);
}

.btn.small {
    font-size: 13px;
    padding: 8px 12px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.interval-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    margin-left: 10px;
}

.interval-select {
    margin-left: 8px;
}

#status {
    color: var(--muted);
    font-size: 13px;
    margin-left: 8px;
}

.badge {
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #042f2e;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.badge:hover {
    transform: scale(1.05);
}

/* Notice */
.notice {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.notice code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Scripts Grid */
.scripts-section {
    margin: 24px 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(20px);
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-content {
    flex: 1;
}

.card h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: #ffffff;
}

.card .meta {
    color: var(--muted);
    font-size: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    background: #071422;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.creator {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.1);
}

.creator-info {
    flex: 1;
}

.creator-name {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 4px;
}

.creator-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}

.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.card-actions .btn {
    font-size: 12px;
    padding: 6px 10px;
}

.language-tag {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.code {
    width: 100%;
    max-height: 200px;
    margin-top: 12px;
    background: #0a0e1a;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #e1e7ef;
    overflow: auto;
    border: 1px solid var(--glass-border);
    white-space: pre;
    line-height: 1.5;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

.code::-webkit-scrollbar {
    width: 6px;
}

.code::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.code::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.no-results h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #ffffff;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 30px 0;
}

/* Footer */
footer {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.footer-section p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    color: var(--muted);
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app {
        padding: 15px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .header-right {
        margin-left: 0;
        align-self: flex-end;
    }

    header h1 {
        font-size: 24px;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .interval-label {
        margin-left: 0;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .thumbnail {
        width: 100%;
        height: 120px;
        margin-left: 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ad-top .ad-placeholder,
    .ad-bottom .ad-placeholder {
        width: 320px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .card-actions {
        justify-content: center;
    }

    .search-container {
        max-width: 100%;
    }

    .pagination {
        flex-direction: column;
        align-items: center;
    }
}

/* Loading States */
.loading .btn-text {
    opacity: 0;
}

.loading .loading-spinner {
    display: inline-block;
}