@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;700&display=swap');

/* הגדרת משתני עיצוב גלובליים - ערכת נושא ורוד ניאון ושחור חלק */
:root {
    --bg-main: #000000; /* רקע שחור חלק */
    --bg-card: rgba(10, 10, 10, 0.85); /* כרטיסיות פחם כהות */
    --bg-card-hover: rgba(20, 20, 20, 0.95);
    --border-color: rgba(255, 0, 127, 0.25); /* גבול ורוד ניאון עדין */
    --text-primary: #ffffff; /* לבן ברור וקריא */
    --text-secondary: #ffb3d9; /* ורוד בהיר מעודן */
    --text-muted: #8b8b9f;
    
    /* צבעי מוטיבציה ואנרגיה */
    --primary-gradient: linear-gradient(135deg, #00f2fe, #4facfe); /* כחול טורקיז/ציאן זוהר מותאם גרפית לכפתורים */
    --secondary-gradient: linear-gradient(135deg, #ff007f, #ff66b2); /* ורוד ניאון זוהר */
    --yinon-gradient: linear-gradient(135deg, #ffd700, #ffa500); /* זהב של מלך */
    --daniel-gradient: linear-gradient(135deg, #9d4edd, #5a189a); /* סגול מלכותי */
    
    --color-yinon: #ffd700;
    --color-daniel: #c77dff;
    --color-unassigned: #a0aec0;
    
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 8px 32px 0 rgba(255, 0, 127, 0.18); /* צל ניאון ורוד */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* אתחול כללי */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Rubik', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    overflow-x: hidden;
    /* רקע שחור עם הילה ורודה עדינה בפינות */
    background-image: 
        radial-gradient(at 10% 20%, rgba(255, 0, 127, 0.07) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(0, 242, 254, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
}

/* סרגל גלילה מעוצב */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #1f121a;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #ff007f;
}

/* קונטיינר מרכזי */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* --- תפריט ניווט עליון --- */
header {
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

.nav-links {
    display: flex;
    gap: 15px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links li.active a {
    color: var(--text-primary);
    background: rgba(255, 0, 127, 0.1);
}

.nav-links li.active a {
    border-bottom: 2px solid #ff007f;
    border-radius: 8px 8px 0 0;
    text-shadow: 0 0 5px #ff007f;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* --- דף התחברות --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 10px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.login-card h2 {
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff007f;
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.4);
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* --- כרטיסיות KPIs --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    margin-top: 10px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: #ff007f;
    box-shadow: 0 8px 32px 0 rgba(255, 0, 127, 0.3);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.kpi-card.total::before { background: var(--secondary-gradient); }
.kpi-card.views::before { background: var(--primary-gradient); }
.kpi-card.conversion::before { background: var(--secondary-gradient); }
.kpi-card.yinon::before { background: var(--yinon-gradient); }
.kpi-card.daniel::before { background: var(--daniel-gradient); }
.kpi-card.unassigned::before { background: var(--color-unassigned); }

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.kpi-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- כותרות וקטעי מוטיבציה --- */
.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 0, 127, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.welcome-text h1 {
    font-size: 2rem;
    margin-bottom: 6px;
    font-weight: 700;
}

.welcome-text h1 span.highlight {
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.2);
}

.welcome-text p {
    color: var(--text-secondary);
}

/* דף ינון / דניאל כותרות ייחודיות */
.page-header-yinon h1 {
    font-size: 2.5rem;
    background: var(--yinon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.page-header-daniel h1 {
    font-size: 2.5rem;
    background: var(--daniel-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

/* --- אזור סינון ופעולות --- */
.actions-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.filters-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex-grow: 1;
}

.search-input-wrapper {
    position: relative;
    min-width: 250px;
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 15px 10px 35px;
    border-radius: 8px;
    outline: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: #ff007f;
    box-shadow: 0 0 0 2px rgba(255, 0, 127, 0.25);
}

.select-control {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.select-control:focus {
    border-color: #ff007f;
}

/* --- טבלאות לידים --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

th {
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 16px 20px;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 16px 20px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 0, 127, 0.1);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 0, 127, 0.02);
}

tr:last-child td {
    border-bottom: none;
}

/* תגיות סטטוס */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-badge.status-yinon {
    background: rgba(255, 215, 0, 0.15);
    color: var(--color-yinon);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.status-badge.status-daniel {
    background: rgba(199, 125, 255, 0.15);
    color: var(--color-daniel);
    border: 1px solid rgba(199, 125, 255, 0.3);
}

.status-badge.status-unassigned {
    background: rgba(160, 174, 192, 0.15);
    color: var(--color-unassigned);
    border: 1px solid rgba(160, 174, 192, 0.3);
}

/* פקדי שינוי סטטוס מהיר בטבלה */
.status-select-table {
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.status-select-table:focus {
    border-color: #ff007f;
    box-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
}

/* כפתור טלפון לחיוג מהיר */
.call-btn {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: var(--transition);
}

.call-btn:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

/* --- טפסים וכפתורים עיקריים --- */
.btn-primary {
    background: var(--primary-gradient); /* כפתורים כחולים ציאן מותאמים */
    color: black; /* ניגודיות גבוהה לכפתור בהיר */
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.6);
}

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

.input-group {
    margin-bottom: 20px;
    text-align: right;
}

.input-label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.input-control-full {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    transition: var(--transition);
    font-size: 1rem;
}

.input-control-full:focus {
    border-color: #ff007f;
    box-shadow: 0 0 0 2px rgba(255, 0, 127, 0.2);
}

/* טופס הוספה ידנית של ליד */
.add-lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

.add-lead-card h3 {
    margin-bottom: 18px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #ff007f;
}

.grid-3-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

/* --- דף מרכז קישורים --- */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 330px; /* הוגדל קלות להעתקת קישורים */
}

.link-card:hover {
    transform: translateY(-8px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow);
    border-color: #ff007f;
}

.link-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.link-icon {
    font-size: 2.5rem;
    padding: 10px;
    background: rgba(255, 0, 127, 0.05);
    border: 1px solid rgba(255, 0, 127, 0.15);
    border-radius: 12px;
}

.link-stat {
    background: rgba(255, 0, 127, 0.15);
    color: #ff3399;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.link-card-body h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 700;
    color: #ff007f;
}

.link-card-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.link-card-footer {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-link-action {
    display: block;
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.link-card:hover .btn-link-action {
    background: rgba(255, 0, 127, 0.1);
    border-color: #ff007f;
}

.btn-copy-link {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--primary-gradient);
    color: black;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy-link:hover {
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

/* --- אנימציות --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* התאמה למסכי מובייל */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .actions-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-group {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .grid-3-cols {
        grid-template-columns: 1fr;
    }
}

/* --- גריד עליון וקרוסלת מוטיבציה --- */
.top-section-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.motivation-carousel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 280px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.motivation-carousel-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary-gradient);
}

.carousel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ff007f;
    text-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
    margin-bottom: 10px;
    text-align: center;
}

.carousel-viewport {
    flex-grow: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 0, 127, 0.15);
    height: 220px;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background-color: rgba(0, 0, 0, 0.3);
}

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