.names-page-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    background: #f9f9f9;
}

/* --- Single Page Styles (Prioritized) --- */
.names-single-page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Cairo', sans-serif;
    color: #333;
}

.names-hero-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.names-hero-content .names-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.names-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.names-title {
    font-size: 3em;
    margin: 0 0 10px;
    font-weight: 800;
}

.names-subtitle {
    font-size: 1.5em;
    opacity: 0.9;
    font-family: 'Segoe UI', sans-serif;
}

.names-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

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

/* Renamed to avoid conflict with main page .name-card */
.names-single-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #eee;
}

.names-single-card .card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fcfcfc;
}

.names-single-card .card-header h2, .names-single-card h3 {
    margin: 0;
    font-size: 1.2em;
    color: #444;
}

.names-single-card .card-body {
    padding: 20px;
    line-height: 1.8;
    color: #555;
    font-size: 1.1em;
}

/* Sidebar Specifics */
.names-sidebar-col .names-single-card {
    padding: 20px;
}

/* Sidebar Most Viewed List (Renamed) */
.names-sidebar-mv-card {
    border-top: 3px solid #e91e63; /* Distinctive color */
}

.stats-visual {
    margin-top: 15px;
}

.stat-item {
    margin-bottom: 15px;
}

.stat-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #666;
}

.progress-bar {
    background: #eee;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
}

.progress-fill.popular { background: #2ecc71; }
.progress-fill.rare { background: #e74c3c; }

.names-promo-card .promo-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.promo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    transition: transform 0.2s;
}

.promo-btn:hover {
    transform: translateY(-2px);
}

.promo-btn.boy-btn { background: #3498db; }
.promo-btn.girl-btn { background: #e91e63; }

/* Footer */
.names-footer-actions {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.names-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: #666;
    font-weight: bold;
}

.names-share-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.share-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: transform 0.2s;
}

.share-icon:hover { transform: scale(1.1); }
.share-icon.twitter { background: #000; }
.share-icon.facebook { background: #3b5998; }
.share-icon.whatsapp { background: #25d366; }

/* --- End Single Page Styles --- */

.names-page-header {
    text-align: center;
    margin-bottom: 30px;
}

.names-page-header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

#names-total-count-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 200px;
}

.count-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.count-number {
    font-size: 2.5em;
    font-weight: bold;
    line-height: 1;
}

.names-page-stats-container {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-top: 20px;
}

.names-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.names-search-box input,
.names-filters select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.names-search-box {
    flex-grow: 1;
}

.names-search-box input {
    width: 100%;
}

.names-btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.names-btn-primary:hover {
    background-color: #0056b3;
}

.names-btn-icon {
    background: #f0f2f5;
    border: 1px solid #ddd;
    color: #555;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.names-btn-icon:hover {
    background: #e4e6e9;
    color: #007bff;
    border-color: #007bff;
    transform: translateY(-2px);
}

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

.name-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
}

.name-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.name-card h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8em;
}

.name-card .en-name {
    color: #7f8c8d;
    font-size: 1em;
    margin-bottom: 10px;
    display: block;
}

.name-card .meaning {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
    height: 40px; /* limit height */
    overflow: hidden;
}

.name-stats {
    display: flex;
    justify-content: center;
    gap: 8px; /* Reduced gap to fit 3 items */
    margin-top: 15px;
    font-size: 0.8em;
    color: #666;
}

.vote-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 8px; /* Slightly tighter padding */
    border-radius: 8px; /* More modern rounded corners */
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1; /* Distribute space evenly */
    justify-content: center;
    white-space: nowrap; /* Prevent text wrapping */
}

.vote-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

/* Link Icon Style */
.name-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px !important; /* Force width over dashicons default */
    height: 34px !important; /* Force height over dashicons default */
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
    flex: 0 0 auto; /* Don't shrink/grow */
    font-size: 20px; /* Set icon size */
    line-height: 1;
}

.name-link-icon:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Ensure dashicons font is used if class is missing (fallback) or enforced */
.name-link-icon.dashicons {
    font-family: "dashicons";
    text-decoration: none; /* Override dashicons */
}

.vote-btn.popular:hover, .vote-btn.popular.active {
    background-color: #2ecc71;
    color: #000;
    border-color: #2ecc71;
    font-weight: bold;
}

.vote-btn.rare:hover, .vote-btn.rare.active {
    background-color: #e74c3c;
    color: #000; /* Changed to black for better readability as requested */
    border-color: #e74c3c;
    font-weight: bold;
}

/* Override for better visibility if requested */
.vote-btn.popular:hover span, .vote-btn.popular.active span {
    color: #000;
}
.vote-btn.rare:hover span, .vote-btn.rare.active span {
    color: #000;
}

.vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* Modal */
.names-modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
}

.names-modal-content {
    background-color: #fefefe;
    margin: 10% auto; 
    padding: 30px;
    border: 1px solid #888;
    width: 90%; 
    max-width: 500px;
    border-radius: 10px;
    direction: rtl;
}

.names-close-modal {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.names-close-modal:hover,
.names-close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Loader */
.names-loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    grid-column: 1 / -1;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .names-page-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .names-search-box, .names-filters {
        width: 100%;
    }
}
.names-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 16px;
}

.names-toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* --- Widget Styles --- */

/* Trending Widget */
.names-widget-trending {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.names-widget-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.names-widget-tab {
    flex: 1;
    background: linear-gradient(135deg, #1e88e5, #1565c0);
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: bold;
    color: #fff;
    transition: all 0.3s;
    border-radius: 10px;
    margin: 8px;
}

.names-widget-tab:hover {
    filter: brightness(1.1);
}

.names-widget-tab.active {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
}

.names-widget-content {
    padding: 10px;
    min-height: 150px;
}

.names-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.names-widget-list li {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.names-widget-list li:last-child {
    border-bottom: none;
}

.names-rank {
    background: linear-gradient(135deg, #eceff1, #e0e0e0);
    color: #333;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    margin-left: 10px;
}

.names-name-link {
    flex: 1;
    color: inherit;
    text-decoration: none;
    padding: 0 10px;
    display: block; /* Helps with clickable area */
}

.names-name {
    font-weight: bold;
}

.names-votes {
    font-size: 12px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.names-widget-list .dashicons-heart {
    color: #e74c3c;
}

.names-widget-list .dashicons-star-filled {
    color: #f1c40f;
}

.names-widget-footer {
    padding: 10px;
    display: flex;
    justify-content: center;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.names-widget-link {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6f61, #ff8a65);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.names-widget-link:hover {
    filter: brightness(1.05);
}
/* Spinner Widget */
.names-widget-spinner {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    text-align: center;
}

.names-spinner-result {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.spinner-placeholder {
    color: #aaa;
    font-style: italic;
}

.spinner-name {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.spinner-meaning {
    font-size: 14px;
    color: #555;
}

.spinner-loader {
    color: #3498db;
    font-weight: bold;
}

.names-spinner-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.names-spinner-btn {
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
}

.names-spinner-btn:active {
    transform: scale(0.95);
}

.btn-spin-boy { background: #3498db; }
.btn-spin-girl { background: #e91e63; }

/* Most Viewed Section */
.names-most-viewed-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border-top: 3px solid #ff9800;
}

.names-most-viewed-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
}

.names-most-viewed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.most-viewed-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    cursor: pointer; /* Ensure pointer cursor */
}

.most-viewed-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: #ff9800;
}

.mv-rank {
    font-size: 1.5em;
    font-weight: 900;
    color: #e0e0e0;
    margin-left: 15px;
    line-height: 1;
    min-width: 30px;
    text-align: center;
    transition: color 0.3s;
    flex-shrink: 0;
}

.most-viewed-item:hover .mv-rank {
    color: #ff9800;
}

.mv-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* Important for text-overflow to work in flex child */
}

.most-viewed-item .mv-name {
    font-weight: bold;
    color: #333;
    font-size: 1.2em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.most-viewed-item .mv-count {
    font-size: 0.9em;
    color: #777;
    display: flex;
    align-items: center;
    gap: 5px;
}

.most-viewed-item .mv-count::before {
    content: '\f177'; /* dashicons-visibility */
    font-family: 'dashicons';
    font-size: 14px;
    color: #bbb;
}

.names-simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.names-simple-list li {
    border-bottom: 1px solid #eee;
}

.names-simple-list li:last-child {
    border-bottom: none;
}

/* Updated List Item Wrapper */
.names-simple-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px;
    color: #333;
    transition: background 0.2s;
    position: relative;
    cursor: pointer;
}

.names-simple-list-item:hover {
    background: #f9f9f9;
    color: #e91e63;
}

.names-simple-list .name-text {
    font-weight: 600;
}

.names-simple-list .view-count {
    font-size: 0.85em;
    color: #888;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Accessibility */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Stretched Link for Tooltip Fix */
.names-stretched-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0; /* Visually hidden */
    cursor: pointer;
}
