/* ============================================================
   Kisho SocialPub — Design System
   Cyan #00e5ff / Violet #7c4dff / Pink #ff4081
   Orbitron (display) + Rajdhani (body)
   ============================================================ */

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

:root {
    --cyan: #00e5ff;
    --violet: #7c4dff;
    --pink: #ff4081;
    --bg-deep: #0a0e1a;
    --bg-panel: rgba(18, 24, 40, 0.85);
    --bg-panel-solid: #121828;
    --bg-input: rgba(10, 14, 26, 0.6);
    --border: rgba(0, 229, 255, 0.15);
    --border-hover: rgba(0, 229, 255, 0.4);
    --text: #dbdee1;
    --text-dim: #8a92a5;
    --text-bright: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

html, body {
    background: linear-gradient(135deg, var(--bg-deep) 0%, #0d1226 50%, #0a0e1a 100%);
    color: var(--text);
    font-family: 'Rajdhani', system-ui, sans-serif;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: 0.02em;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.k-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, rgba(10, 14, 26, 0.98) 0%, rgba(18, 24, 40, 0.98) 100%);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.k-main {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.k-header {
    margin-bottom: 2rem;
}

.k-page-title {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Logo */
.k-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.k-logo-mark {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px var(--cyan));
}

.k-logo-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--cyan);
    line-height: 1;
}

.k-logo-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Nav */
.k-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.k-nav-group {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem 0.5rem 0.5rem;
    font-weight: 600;
}

.k-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.k-nav-item:hover {
    background: rgba(0, 229, 255, 0.05);
    color: var(--cyan);
    text-decoration: none;
}

.k-nav-item.active {
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.15) 0%, rgba(124, 77, 255, 0.05) 100%);
    border-left: 2px solid var(--cyan);
    color: var(--cyan);
}

/* User footer */
.k-sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.k-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.k-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-deep);
    font-weight: 700;
    font-size: 1rem;
}

.k-user-name { font-weight: 600; color: var(--text-bright); }
.k-user-role { font-size: 0.75rem; color: var(--text-dim); }

.k-logout {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.k-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ============================================================
   CARDS & TABLES
   ============================================================ */
.k-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 20px rgba(0, 229, 255, 0.03);
    backdrop-filter: blur(10px);
}

.k-card-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--cyan);
}

.k-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.k-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 3rem 1rem;
}

.k-table {
    width: 100%;
    border-collapse: collapse;
}

.k-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
}

.k-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.k-table tr:hover td { background: rgba(0, 229, 255, 0.02); }

/* ============================================================
   STATS
   ============================================================ */
.k-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.k-stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.k-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.k-stat-success::before { background: var(--success); }
.k-stat-warning::before { background: var(--warning); }
.k-stat-danger::before { background: var(--danger); }
.k-stat-info::before { background: var(--cyan); }

.k-stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.k-stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.k-stat-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ============================================================
   FORMS
   ============================================================ */
.k-field {
    margin-bottom: 1.25rem;
}

.k-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.k-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.k-field-header label {
    margin: 0;
}

.k-field input[type="text"],
.k-field input[type="email"],
.k-field input[type="password"],
.k-field input[type="url"],
.k-field input[type="number"],
.k-field input[type="datetime-local"],
.k-field select,
.k-field textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.k-field input:focus,
.k-field select:focus,
.k-field textarea:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.k-field textarea {
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.k-help {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

.k-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.k-checkbox input { width: auto; }

/* ============================================================
   BUTTONS
   ============================================================ */
.k-btn, button.k-btn-primary, button.k-btn-success, button.k-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.k-btn:hover { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }

.k-btn-primary {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
    color: var(--bg-deep) !important;
    border: none;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.k-btn-primary:hover {
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.5);
    transform: translateY(-1px);
    color: var(--bg-deep) !important;
}

.k-btn-success { background: var(--success); color: white; border: none; }
.k-btn-success:hover { filter: brightness(1.1); color: white; }

.k-btn-danger { background: var(--danger); color: white; border: none; }
.k-btn-danger:hover { filter: brightness(1.1); color: white; }

.k-btn-block { width: 100%; justify-content: center; }

.k-btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.15s;
}

.k-btn-sm:hover { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }

.k-btn-ai {
    border-color: var(--violet) !important;
    color: var(--violet) !important;
}

.k-btn-ai:hover {
    background: rgba(124, 77, 255, 0.1);
}

/* ============================================================
   BADGES & DOTS
   ============================================================ */
.k-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(138, 146, 165, 0.2);
    color: var(--text-dim);
}

.k-badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.k-badge-info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.k-badge-primary { background: rgba(0, 229, 255, 0.15); color: var(--cyan); }
.k-badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.k-badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.k-badge-gray { background: rgba(138, 146, 165, 0.15); color: var(--text-dim); }

.k-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.k-dot-green { background: var(--success); box-shadow: 0 0 8px var(--success); }
.k-dot-gray { background: var(--text-dim); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.k-flash {
    padding: 0.8rem 1.2rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 3px solid;
    font-weight: 500;
}

.k-flash-success { background: rgba(16, 185, 129, 0.1); border-color: var(--success); color: var(--success); }
.k-flash-error { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); color: var(--danger); }

/* ============================================================
   GRIDS / LAYOUTS SPÉCIFIQUES
   ============================================================ */
.k-grid-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.k-grid-2col-tight {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 900px) {
    .k-grid-2col, .k-grid-2col-tight { grid-template-columns: 1fr; }
    .k-sidebar { position: relative; width: 100%; }
    .k-main { margin-left: 0; padding: 1rem; }
}

/* ============================================================
   TOOLBAR / FILTERS
   ============================================================ */
.k-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.k-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.k-filter {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.15s;
}

.k-filter:hover { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }
.k-filter.active { background: rgba(0, 229, 255, 0.1); border-color: var(--cyan); color: var(--cyan); }

/* ============================================================
   MEDIA GRID
   ============================================================ */
.k-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.k-media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.k-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.k-media-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* ============================================================
   TARGETS
   ============================================================ */
.k-target-row {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.k-target-status {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.k-error-msg {
    width: 100%;
    font-size: 0.8rem;
    color: var(--danger);
    font-family: 'Consolas', monospace;
}

.k-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.k-info-row:last-child { border: 0; }
.k-info-row span { color: var(--text-dim); }

/* ============================================================
   AI VARIATIONS
   ============================================================ */
.k-ai-variations {
    background: rgba(124, 77, 255, 0.08);
    border: 1px solid rgba(124, 77, 255, 0.3);
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.k-ai-variations-title {
    font-size: 0.85rem;
    color: var(--violet);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.k-ai-variation {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    transition: all 0.15s;
}

.k-ai-variation:hover {
    border-color: var(--violet);
    background: rgba(124, 77, 255, 0.1);
}

.k-ai-status {
    margin-top: 0.75rem;
    padding: 0.5rem;
    font-size: 0.85rem;
    text-align: center;
}

/* ============================================================
   MODAL
   ============================================================ */
.k-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.k-modal-content {
    background: var(--bg-panel-solid);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 229, 255, 0.1);
}

.k-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.k-modal-header h3 { color: var(--cyan); }

.k-modal-header button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
}

.k-modal-header button:hover { color: var(--danger); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.k-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 229, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(124, 77, 255, 0.1) 0%, transparent 40%),
        linear-gradient(135deg, #0a0e1a 0%, #121828 100%);
}

.k-login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 229, 255, 0.08);
    backdrop-filter: blur(10px);
}

.k-login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Utility */
.k-warn, .k-warn-text { color: var(--warning); font-size: 0.85rem; }
