@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

body, body.dark-mode {
    background-color: #202124;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #e8eaed;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.light-mode {
    background-color: #f8f9fa;
    color: #202124;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: transparent;
}

.top-right-widgets {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: inherit;
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.clock-widget-top {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
}

.clock-time-top {
    font-size: 18px;
    letter-spacing: 1px;
    color: #8ab4f8;
}

body.light-mode .clock-time-top {
    color: #1a73e8;
}

.clock-sep {
    opacity: 0.5;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

body.light-mode .icon-btn {
    background: #e8eaed;
    color: #3c4043;
}

.icon-btn:hover { background: #5f6368; color: #fff; }

.container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 20px 15px;
    width: 100%;
    flex: 1;
}

.logo {
    text-align: center;
    margin-bottom: 25px;
}

/* فاصله بین حروف Karpit کمی کمتر شد */
.logo h1 {
    font-size: 55px;
    color: #ffffff;
    letter-spacing: 8px;
    font-weight: 800;
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

body.light-mode .logo h1 {
    color: #1a73e8;
    text-shadow: none;
}

.search-container {
    max-width: 620px;
    margin: 0 auto 25px auto;
}

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

.search-tab {
    background: rgba(48, 49, 52, 0.8);
    color: #9aa0a6;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}

body.light-mode .search-tab {
    background: #e8eaed;
    color: #5f6368;
    border-color: #ccc;
}

.search-tab.active {
    background: #8ab4f8;
    color: #202124;
    border-color: #8ab4f8;
    font-weight: bold;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    background: rgba(48, 49, 52, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 10px 42px 10px 42px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

body.light-mode .search-box input {
    background: #ffffff;
    border-color: #ccc;
    color: #202124;
}

.search-box .search-icon {
    position: absolute;
    right: 14px;
    color: #9aa0a6;
}

.search-submit-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 4px;
}

.folder-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    background: rgba(45, 46, 49, 0.7);
    padding: 8px 16px;
    border-radius: 12px;
    width: fit-content;
}

.back-btn {
    background: #3c4043;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn:hover { background: #5f6368; }

.folder-title-nav {
    font-size: 14px;
    font-weight: bold;
    color: #8ab4f8;
    margin-right: 8px;
}

/* شبکه ۱۰ تایی منظم با فاصله کم */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    margin-bottom: 25px;
}

@media (max-width: 1200px) { .bookmarks-grid { grid-template-columns: repeat(8, 1fr); } }
@media (max-width: 992px) { .bookmarks-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 768px) { .bookmarks-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .bookmarks-grid { grid-template-columns: repeat(3, 1fr); } }

.bookmark-card {
    position: relative;
    background: rgba(45, 46, 49, 0.85);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 4px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: #ffffff !important;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
    height: 82px !important;
    width: 100%;
}

body.light-mode .bookmark-card {
    background: #ffffff;
    border-color: #dadce0;
    color: #202124 !important;
}

.bookmark-card:hover {
    background: rgba(60, 64, 67, 0.95);
    transform: translateY(-2px);
}

body.light-mode .bookmark-card:hover {
    background: #f1f3f4;
}

.bookmark-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
}

.bookmark-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 4px;
}

.bookmark-title {
    font-size: 11px;
    color: inherit;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    margin-top: 2px;
}

.admin-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
    gap: 2px;
    z-index: 10;
}

body.is-admin .bookmark-card:hover .admin-actions {
    display: flex;
}

.admin-actions button {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-actions button:hover { background: #1a73e8; }
.admin-actions button.btn-del:hover { background: #dc3545; }

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

.add-btn {
    background: rgba(48, 49, 52, 0.8);
    color: #8ab4f8;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

body.light-mode .add-btn {
    background: #ffffff;
    color: #1a73e8;
    border-color: #ccc;
}

.add-btn:hover { background: #3c4043; }

.admin-only { display: none; }
body.is-admin .admin-only { display: flex; }

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: #202124;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    width: 400px;
    max-width: 90%;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal input, .modal select, .modal textarea {
    background: #303134;
    border: 1px solid #555;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.modal-buttons button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.save-btn { background: #1a73e8; color: #fff; }
.cancel-btn { background: #5f6368; color: #fff; }

.footer-fixed-bar {
    background: rgba(23, 23, 23, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    overflow: hidden;
}

body.light-mode .footer-fixed-bar {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #dadce0;
}

.ticker-wrapper {
    flex: 1;
    overflow: hidden;
    margin: 0 20px;
    white-space: nowrap;
}

.ticker-content {
    display: inline-block;
    animation: tickerAnim 20s linear infinite;
}

@keyframes tickerAnim {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.footer-custom-links a {
    color: #9aa0a6;
    text-decoration: none;
    margin-left: 12px;
}

.ai-chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4285f4, #9b51e0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 99999;
}

.ai-chat-box {
    position: fixed;
    bottom: 75px;
    left: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 450px;
    background: #202124;
    border: 1px solid #444;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    color: #fff;
}

.ai-chat-header {
    background: #303134;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #444;
}

.ai-chat-header-title { display: flex; align-items: center; gap: 8px; font-weight: bold; font-size: 13px; }
.ai-chat-header-close { cursor: pointer; opacity: 0.7; font-size: 15px; }

.ai-chat-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 10px;
    line-height: 1.5;
    word-wrap: break-word;
}
.chat-msg.bot { background: #303134; color: #e8eaed; align-self: flex-start; border-bottom-right-radius: 2px; }
.chat-msg.user { background: #1a73e8; color: #fff; align-self: flex-end; border-bottom-left-radius: 2px; }

.ai-chat-footer {
    padding: 8px;
    background: #303134;
    border-top: 1px solid #444;
    display: flex;
    gap: 6px;
}
.ai-chat-footer input {
    flex: 1;
    background: #202124;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    outline: none;
    font-size: 12px;
}
.ai-chat-footer button {
    background: #1a73e8;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* تنظیم نوار فوتر با ارتفاع مناسب برای قرارگیری نمادها */
.footer-fixed-bar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    min-height: 60px;
}

/* قرارگیری نمادها در وسطِ فوتر با فاصله مناسب از خط بالایی */
.footer-badges {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background: transparent;
    padding: 2px 8px;
}

.footer-badges img {
    height: 34px;
    object-fit: contain;
    border-radius: 4px;
}

/* مدیریت فضای بخش‌های چپ و راست فوتر */
.footer-socials {
    display: flex;
    gap: 10px;
    z-index: 2;
}

.ticker-wrapper {
    flex: 1;
    margin: 0 160px;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1;
}

.footer-custom-links {
    display: flex;
    gap: 12px;
    z-index: 2;
}
/* استایل ویجت آمارگیر زنده در فوتر سایت کارپیت */
.footer-live-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: #e8eaed;
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #28a745;
    animation: pulseAnim 1.5s infinite;
}

@keyframes pulseAnim {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}
/* افکت کارت‌های ویژه و اسپانسر شده */
.bookmark-card.vip-card {
    border: 1px solid #fbbc04 !important;
    box-shadow: 0 0 10px rgba(251, 188, 4, 0.25);
}

.bookmark-card.vip-card::after {
    content: "ویژه";
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 8px;
    background: #fbbc04;
    color: #202124;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: bold;
}

/* دکمه میکروفون جستجوی صوتی */
.voice-search-btn {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #9aa0a6;
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    transition: color 0.2s;
}

.voice-search-btn.listening {
    color: #ea4335;
    animation: pulseMic 1s infinite alternate;
}

@keyframes pulseMic {
    from { transform: translateY(-50%) scale(1); }
    to { transform: translateY(-50%) scale(1.25); }
}

/* انیمیشن کشیدن و رها کردن */
.bookmark-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}
/* استایل کارت‌های VIP و اسپانسری */
.bookmark-card.vip-card {
    border: 1.5px solid #fbbc04 !important;
    background: linear-gradient(145deg, rgba(251, 188, 4, 0.1), rgba(0, 0, 0, 0.2)) !important;
    box-shadow: 0 0 12px rgba(251, 188, 4, 0.25) !important;
    position: relative;
}

.bookmark-card.vip-card::after {
    content: "ویژه";
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 8px;
    background: #fbbc04;
    color: #202124;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 2;
}