/**
 * Admin Panel - Styles CSS
 */

/* ==================== VARIABLES ==================== */
:root {
    --admin-primary: #171717;
    --admin-secondary: #404040;
    --admin-accent: #2563eb;
    --admin-danger: #dc2626;
    --admin-success: #16a34a;
    --admin-bg: #f5f5f5;
    --admin-white: #ffffff;
    --admin-border: #e5e5e5;
    --admin-text: #171717;
    --admin-text-muted: #737373;
    --admin-sidebar-width: 260px;
    --admin-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --admin-font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* ==================== RESET ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--admin-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--admin-text);
    background-color: var(--admin-bg);
}

/* ==================== PAGE DE CONNEXION ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #171717 0%, #404040 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--admin-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    font-family: var(--admin-font-mono);
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
}

.login-subtitle {
    color: var(--admin-text-muted);
    text-align: center;
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--admin-text-muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--admin-text);
}

/* ==================== LAYOUT ADMIN ==================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-primary);
    color: var(--admin-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid var(--admin-secondary);
}

.sidebar-header h2 {
    font-family: var(--admin-font-mono);
    font-size: 18px;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 12px;
    color: #a3a3a3;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #a3a3a3;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: var(--admin-secondary);
    color: var(--admin-white);
}

.sidebar-nav .badge {
    background: var(--admin-accent);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--admin-secondary);
}

.sidebar-footer a {
    display: block;
    padding: 8px 0;
    color: #a3a3a3;
    text-decoration: none;
    font-size: 13px;
}

.sidebar-footer a:hover {
    color: var(--admin-white);
}

.logout-link {
    color: var(--admin-danger) !important;
}

/* ==================== MAIN CONTENT ==================== */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    padding: 30px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-header h1 {
    font-family: var(--admin-font-mono);
    font-size: 24px;
}

.admin-header p {
    color: var(--admin-text-muted);
    margin-top: 4px;
}

/* ==================== ALERTES ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: var(--admin-success);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: var(--admin-danger);
    border: 1px solid #fecaca;
}

/* ==================== BOUTONS ==================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--admin-primary);
    color: var(--admin-white);
}

.btn-primary:hover {
    background: var(--admin-secondary);
}

.btn-secondary {
    background: var(--admin-border);
    color: var(--admin-text);
}

.btn-secondary:hover {
    background: #d4d4d4;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==================== DASHBOARD ==================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--admin-white);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--admin-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-text);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 600;
}

.stat-info p {
    color: var(--admin-text-muted);
    font-size: 13px;
}

.stat-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--admin-accent);
    color: white;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
}

.dashboard-actions h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* ==================== MESSAGES ==================== */
.messages-list {
    display: grid;
    gap: 16px;
}

.message-card {
    background: var(--admin-white);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 20px;
}

.message-card.unread {
    border-left: 4px solid var(--admin-accent);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.message-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.message-email {
    color: var(--admin-text-muted);
    font-size: 13px;
}

.message-meta {
    text-align: right;
}

.message-date {
    font-size: 12px;
    color: var(--admin-text-muted);
    display: block;
    margin-bottom: 4px;
}

.badge-new {
    background: var(--admin-accent);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.message-subject {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--admin-text);
}

.message-body {
    background: var(--admin-bg);
    padding: 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.message-actions {
    display: flex;
    gap: 8px;
}

/* ==================== PROJETS ==================== */
.projects-table {
    background: var(--admin-white);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
}

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

.projects-table th,
.projects-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.projects-table th {
    background: var(--admin-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--admin-text-muted);
}

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

.projects-table tr:hover {
    background: var(--admin-bg);
}

.project-thumb {
    width: 80px;
}

.project-thumb img {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.project-thumb .no-image {
    width: 60px;
    height: 40px;
    background: var(--admin-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--admin-text-muted);
}

.tech-tag {
    display: inline-block;
    font-family: var(--admin-font-mono);
    font-size: 11px;
    padding: 2px 8px;
    background: var(--admin-bg);
    border-radius: 3px;
    margin: 2px;
}

.actions {
    white-space: nowrap;
}

.actions .btn {
    margin-right: 4px;
}

/* ==================== FORMULAIRE PROJET ==================== */
.form-container {
    background: var(--admin-white);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
}

.form-container h2 {
    font-size: 20px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--admin-border);
}

.project-form .form-group {
    margin-bottom: 20px;
}

.project-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.project-form input[type="text"],
.project-form input[type="url"],
.project-form input[type="date"],
.project-form input[type="number"],
.project-form select,
.project-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--admin-font);
    transition: border-color 0.2s;
}

.project-form input:focus,
.project-form select:focus,
.project-form textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.project-form textarea {
    resize: vertical;
    min-height: 100px;
}

.project-form small {
    display: block;
    margin-top: 6px;
    color: var(--admin-text-muted);
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.current-image {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--admin-bg);
    border-radius: 4px;
}

.current-image img {
    max-width: 200px;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.current-image p {
    font-size: 12px;
    color: var(--admin-text-muted);
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
}

/* ==================== NO DATA ==================== */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--admin-text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media screen and (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .message-header {
        flex-direction: column;
        gap: 8px;
    }

    .message-meta {
        text-align: left;
    }

    .projects-table {
        overflow-x: auto;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* ==================== COMPETENCES (PAGE SKILLS) ==================== */
.skills-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.category-block {
    background: var(--admin-white);
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--admin-bg);
    border-bottom: 1px solid var(--admin-border);
}

.category-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    flex: 1;
    min-width: 120px;
    margin: 0;
}

.category-order {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    margin-right: auto;
}

.skills-list {
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: flex-start;
    min-height: 2.5rem;
}

.skill-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.skill-item .skill-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.1rem;
}

.skill-item a {
    font-size: 0.75rem;
    color: var(--admin-text-muted);
    text-decoration: none;
    line-height: 1;
}

.skill-item a:hover {
    color: var(--admin-primary);
}

.skill-item a.del {
    color: var(--admin-danger);
}

.add-skill-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem;
    border-top: 1px dashed var(--admin-border);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

.add-skill-inline input[type="text"] {
    flex: 1;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--admin-font);
}

.add-skill-inline input[type="text"]:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.add-skill-inline input[type="number"] {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--admin-border);
    border-radius: 4px;
    font-size: 13px;
}

.add-skill-inline input[type="number"]:focus {
    outline: none;
    border-color: var(--admin-primary);
}

/* Responsive skills — tablette */
@media screen and (max-width: 768px) {
    .category-header {
        gap: 0.4rem;
    }

    .category-header h3 {
        width: 100%;
        min-width: 0;
        margin-bottom: 0.25rem;
    }

    .category-order {
        margin-right: 0;
    }
}

/* Responsive skills — mobile */
@media screen and (max-width: 540px) {
    .category-header {
        flex-direction: column;
        align-items: stretch;
    }

    .category-header h3 {
        margin-bottom: 0.5rem;
    }

    .category-header .btn {
        width: 100%;
        text-align: center;
    }

    .skills-list {
        padding: 0.6rem 0.75rem;
    }

    .add-skill-inline {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
    }

    .add-skill-inline input[type="text"],
    .add-skill-inline input[type="number"] {
        width: 100%;
        min-width: 0;
    }

    .add-skill-inline .btn {
        width: 100%;
        text-align: center;
    }

    .form-container {
        padding: 20px 16px;
    }
}
