/* --- CSS Variables for Theming --- */
:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --accent-color: #ff6b6b;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #333;
    --body-bg: #fdfdff;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 4px 15px rgba(0,0,0,0.07);
    --border-radius: 8px;
    --gradient-primary: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--body-bg);
    color: var(--text-color);
    margin: 0;
}

header {
    background: var(--card-bg);
    color: var(--dark-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

header a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 700;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 a {
    font-size: 1.5rem;
}

.header-content nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-content nav a {
    font-weight: 500;
    color: var(--secondary-color);
}
.header-content nav a:not(:last-child) {
    border-right: 1px solid var(--border-color);
    padding-right: 15px;
}

main {
    padding: 0;
}

.container {
    max-width: 960px;
    margin: auto;
    background: transparent;
    padding: 20px;
}

.btn {
    display: inline-block;
    background: var(--gradient-primary);
    color: #ffffff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.btn-warning { background-color: var(--warning-color); color: var(--dark-color); }
.btn-warning:hover { background-color: #d39e00; }
.btn-info { background-color: var(--info-color); color: white; }
.btn-info:hover { background-color: #117a8b; }
.btn-delete { background-color: var(--danger-color); color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8em; }
.btn-delete:hover { background-color: #c82333; }

.website-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.website-card {
    text-decoration: none;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.website-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.07);
}

.card-image {
    width: 100%;
    padding-top: 60%; /* Aspect Ratio 5:3 */
    position: relative;
    background-color: #f0f0f0;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 15px;
}

.card-content h3 {
    margin-top: 0;
    margin-bottom: 5px;
}

.card-url {
    margin: 0;
    color: var(--secondary-color);
    font-size: 0.9em;
    word-break: break-all;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--secondary-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.form-container input[type="text"],
.form-container input[type="url"],
.form-container input[type="number"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.error {
    color: var(--danger-color);
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.success {
    color: var(--success-color);
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    color: var(--secondary-color);
}

/* --- Page Specific Styles from website.php --- */
.admin-actions { margin-top: 20px; padding: 15px; background-color: #fff3cd; border: 1px solid #ffeeba; border-radius: var(--border-radius); }
.screenshot-container { margin-bottom: 20px; }
.website-screenshot { max-width: 100%; height: auto; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.vote-section { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.vote-btn { text-decoration: none; color: var(--text-color); background-color: var(--light-color); padding: 4px 8px; border-radius: 4px; font-size: 0.9em; border: 1px solid var(--border-color); transition: background-color 0.2s; }
.vote-btn:hover { background-color: #e2e6ea; }
.vote-btn.disabled { color: var(--secondary-color); cursor: not-allowed; background-color: #e9ecef; }
.sentiment-section { padding: 10px; margin: 10px 0; background-color: var(--light-color); border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.sentiment-section label { margin-right: 15px; cursor: pointer; }
.comment-list .comment-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
}
.status-verified { color: var(--success-color); font-weight: bold; }
.status-unverified { color: var(--secondary-color); font-weight: bold; }
.verification-section { margin-top: 20px; }
.comment-reply {
    background-color: var(--light-color);
    border-left: 3px solid var(--primary-color);
    padding: 10px;
    margin-top: 10px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* --- Hero Section Styles --- */
.hero-section {
    background: var(--gradient-primary);
    color: #ffffff;
    padding: 4rem 2rem;
    text-align: center;
}
.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}
.hero-section .search-container {
    max-width: 600px;
    margin: 0 auto;
}
.hero-section #searchInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    border-radius: 50px;
    border: 1px solid transparent;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.hero-section #searchInput:focus {
    outline: none;
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}

/* --- Main Content Header --- */
.list-header {
    display: flex;    
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* --- Pagination Styles --- */
.pagination {
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.pagination a {
    color: var(--primary-color);
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: background-color 0.2s, color 0.2s;
}
.pagination a:hover, .pagination a.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}
.pagination a.active {
    cursor: default;
}

/* --- Latest Comments Styles --- */
.latest-comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.comment-preview-item {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
}
.comment-preview-item .comment-text {
    font-style: italic;
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 10px;
}
.comment-preview-item .comment-meta {
    font-size: 0.9em;
    margin: 0;
}
.comment-preview-item .comment-meta a {
    color: var(--primary-hover);
    font-weight: 500;
    text-decoration: none;
}
.comment-preview-item .comment-meta a:hover {
    text-decoration: underline;
}
.status-unsafe { color: var(--danger-color); font-weight: bold; }
.status-review { color: var(--warning-color); font-weight: bold; }
.status-potential { color: var(--info-color); font-weight: bold; }
.status-safe { color: var(--success-color); font-weight: bold; }
.crawler-stats { background-color: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #dee2e6; }

/* --- Star Rating Styles --- */
.star-rating-input-container {
    padding: 10px;
    margin: 10px 0;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}
.star-rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
}
.star-rating-input input[type="radio"] {
    display: none;
}
.star-rating-input label {
    font-size: 1.5rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}
.star-rating-input input:checked ~ label,
.star-rating-input label:hover,
.star-rating-input label:hover ~ label {
    color: var(--warning-color);
}
.star-rating-display { margin-bottom: 10px; }
.star-rating-display span { font-size: 1.2rem; color: #ccc; }
.star-rating-display span.filled { color: var(--warning-color); }
.crawler-stats { background-color: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #dee2e6; }

/* --- Comment Filter Styles --- */
.comment-filter-section {
    background-color: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.comment-filter-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
}
.filter-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.filter-links a {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
}
.filter-links .filter-count { color: var(--secondary-color); font-size: 0.9em; }

/* --- Toggle Switch Styles --- */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    vertical-align: middle;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}
input:checked + .slider { background-color: var(--success-color); }
input:focus + .slider { box-shadow: 0 0 1px var(--success-color); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- Mobile Navigation --- */
.mobile-nav-toggle {
    display: none;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    #primary-navigation {
        position: fixed;
        inset: 0 0 0 30%;
        flex-direction: column;
        padding: min(20vh, 10rem) 2em;
        gap: 2em;
        background: hsl(0 0% 100% / 0.9);
        backdrop-filter: blur(1rem);
        transform: translateX(100%);
        transition: transform 350ms ease-out;
    }
    #primary-navigation[data-visible="true"] {
        transform: translateX(0%);
    }
    .header-content nav a:not(:last-child) {
        border-right: none;
        padding-right: 0;
    }

    .mobile-nav-toggle {
        display: block;
        position: absolute;
        z-index: 9999;
        background-color: transparent;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        width: 2rem;
        height: 2rem;
        border: 0;
        top: 1.5rem;
        right: 1.5rem;
        cursor: pointer;
    }
    .mobile-nav-toggle[aria-expanded="true"] {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M6 6l18 18M24 6L6 24'/%3e%3c/svg%3e");
    }
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        border: 0;
    }

    .hero-section {
        padding: 2.5rem 1rem;
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-section #searchInput {
        padding: 12px 18px;
        font-size: 1rem;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .list-header h2 {
        margin: 0;
    }

    .admin-actions form {
        display: block;
        margin-left: 0 !important;
        margin-bottom: 10px;
    }

    .pagination {
        flex-wrap: wrap;
    }
}
