:root {
    --bg-main: #f0f4f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --primary: #00b4d8;
    --primary-dark: #0077b6;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --hover: #e0f2fe;
    --shadow: rgba(0, 180, 216, 0.1);
    --shadow-hover: rgba(0, 180, 216, 0.2);
    --font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo:hover {
    background: var(--hover);
}

.search-form {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    gap: 8px;
}

.search-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-main);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-sidebar);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: var(--primary-dark);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.category-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.category-item {
    display: block;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.category-item:hover {
    background: var(--hover);
    color: var(--primary);
}

.category-item.active {
    background: var(--hover);
    color: var(--primary);
    border-left-color: var(--primary);
}

.category-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: var(--hover);
    color: var(--primary);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8f4fc 50%, #f0f4f8 100%);
    min-height: 100vh;
}

.header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.site-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.site-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border);
}

.site-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    border-color: var(--primary);
}

.site-card:active {
    transform: scale(0.98);
}

.site-card.top {
    border-color: var(--primary);
    background: linear-gradient(135deg, #ffffff 0%, var(--hover) 100%);
}

.site-logo-wrapper {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-logo {
    width: 64px;
    height: 64px;
    object-fit: cover;
}

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

.site-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    transition: color 0.3s ease;
}

.site-title:hover {
    color: var(--primary);
}

.site-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.top-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.site-card:not(.top) .top-badge {
    display: none;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-main);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--hover);
    color: var(--primary);
}

.modal-body {
    text-align: center;
}

.detail-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 20px;
    background: var(--bg-main);
}

.detail-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.detail-url {
    margin-bottom: 16px;
}

.detail-url a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.detail-url a:hover {
    text-decoration: underline;
}

.detail-description {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
    text-align: left;
    padding: 16px;
    background: var(--bg-main);
    border-radius: 8px;
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        padding: 24px 20px;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .category-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .category-item {
        padding: 10px 16px;
        border-left: none;
        background: var(--bg-main);
        border-radius: 20px;
    }
}