/* Reset & Variables */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6b6b6b;
    --accent-primary: #5865f2;
    --accent-hover: #4752c4;
    --success: #3ba55d;
    --danger: #ed4245;
    --border-color: #2f2f2f;
    --shadow: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
}

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

.login-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 48px 40px;
    box-shadow: 0 8px 32px var(--shadow);
    text-align: center;
}

.logo h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
}

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

.btn-discord:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-primary);
    color: white !important;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: white !important;
}

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

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

.login-info {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--danger);
    color: #ff6b6b;
}

.alert-info {
    background: rgba(88, 101, 242, 0.1);
    border: 1px solid var(--accent-primary);
    color: #7289da;
}

.alert-success {
    background: rgba(59, 165, 93, 0.1);
    border: 1px solid var(--success);
    color: #5ecc7b;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover:not(.disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item .badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-tag {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

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

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

.content-header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: relative;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.menu-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.mobile-menu-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* Sidebar close button */
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-body {
    padding: 32px 40px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Card */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Profile */
.profile-info {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
}

.profile-avatar-large {
    flex-shrink: 0;
}

.profile-avatar-large img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    border: 4px solid var(--bg-tertiary);
}

.profile-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 16px;
    color: var(--text-primary);
}

/* Roles */
.roles-section h4 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.roles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.role-badge::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Form */
.form {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn {
    width: auto;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.text-muted {
    color: var(--text-muted);
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 24px;
}

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

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 48px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

#mod-points-sort {
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    height: 46px;
    line-height: 46px;
}

.clear-search {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    color: var(--text-primary);
}

/* Links List */
.links-list {
    display: grid;
    gap: 16px;
}

.link-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--accent-primary);
}

.link-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-content {
    flex: 1;
}

.link-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.link-url {
    font-size: 14px;
    color: var(--accent-primary);
    text-decoration: none;
    word-break: break-all;
}

.link-url:hover {
    text-decoration: underline;
}

.link-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

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

.link-actions button {
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.link-actions button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.link-actions button.delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px var(--shadow);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

/* Modal Tabs */
.modal-tab {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(88, 101, 242, 0.1);
}

.user-tab-content {
    display: none;
}

.user-tab-content.active {
    display: block;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* User modal specific */
.user-modal-content {
    max-width: 700px;
    width: 700px;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Responsive */

/* Tablettes (768px - 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .content-header h1 {
        font-size: 24px;
    }

    .card-body {
        padding: 20px;
    }
}

/* Mobile et petites tablettes (max 768px) */
@media (max-width: 768px) {
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Sidebar close button */
    .sidebar-close {
        display: block;
    }

    /* Sidebar en overlay */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
        width: 280px;
    }

    .sidebar.open {
        left: 0;
    }

    /* Overlay pour fermer la sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main content prend tout l'espace */
    .main-content {
        width: 100%;
    }

    /* Header mobile avec menu burger */
    .content-header {
        padding: 16px 20px;
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .content-header h1 {
        margin-left: 48px; /* Space for mobile menu button */
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .menu-toggle:hover {
        background: var(--bg-secondary);
        border-color: var(--accent-primary);
    }

    .content-header h1 {
        font-size: 20px;
    }

    .content-body {
        padding: 20px;
    }

    /* Forms responsive */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Profile responsive */
    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-avatar-large img {
        width: 96px;
        height: 96px;
    }

    .profile-details {
        align-items: center;
    }

    /* Cards responsive */
    .card {
        border-radius: 8px;
    }

    .card-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .card-header h3 {
        font-size: 16px;
    }

    .card-header .btn {
        width: 100%;
    }

    .card-body {
        padding: 16px;
    }

    /* Links responsive */
    .link-item {
        flex-direction: column;
        gap: 12px;
    }

    .link-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Search bar responsive */
    .search-input {
        padding: 10px 40px 10px 40px;
        font-size: 14px;
    }

    /* Modal responsive */
    .modal-content {
        width: 95% !important;
        height: auto !important;
        max-height: 90vh !important;
        margin: 20px;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-tab {
        font-size: 13px;
        padding: 12px 16px;
        gap: 6px;
    }

    .modal-tab i {
        font-size: 16px;
    }

    /* Roles list responsive */
    .roles-list {
        justify-content: center;
    }

    .role-badge {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* Form actions responsive */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Birthday form responsive */
    .form-group input,
    .form-group select {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* Slot machine pour mobile */
@media (max-width: 768px) {
    #wheel-desktop {
        display: none !important;
    }

    #slot-machine {
        display: block !important;
    }

    /* Cacher sur mobile */
    .hide-on-mobile {
        display: none !important;
    }

    /* Gestion utilisateurs responsive */
    .mod-user-desktop {
        display: none !important;
    }

    .mod-user-mobile {
        display: block !important;
    }

    /* Stats compactes */
    #mod-points-page .card-body > div:nth-child(2) {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    #mod-points-page .card-body > div:nth-child(2) > div {
        padding: 12px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    #mod-points-page .card-body > div:nth-child(2) > div > div:first-child {
        margin-bottom: 0 !important;
    }

    #mod-points-page .card-body > div:nth-child(2) > div > div:last-child {
        font-size: 20px !important;
    }

    /* Search et sort en colonne */
    #mod-points-sort {
        width: 100%;
    }

    /* User modal responsive */
    .user-modal-content {
        width: 95% !important;
        max-width: 95% !important;
        height: auto !important;
        max-height: 85vh !important;
    }

    #user-modal .modal-body {
        padding: 16px;
    }

    #points-form .form-group label {
        font-size: 13px;
    }

    #birthday-actions {
        flex-direction: column !important;
    }

    #birthday-actions button {
        width: 100%;
    }
}

/* Petit mobile (max 480px) */
@media (max-width: 480px) {
    .content-header {
        padding: 12px 16px;
    }

    .content-header h1 {
        font-size: 18px;
    }

    .content-body {
        padding: 16px;
    }

    .card-header {
        padding: 12px 16px;
    }

    .card-body {
        padding: 12px;
    }

    /* Login page responsive */
    .login-card {
        padding: 32px 24px;
    }

    .logo h1 {
        font-size: 28px;
    }

    /* Sidebar responsive */
    .sidebar-header h2 {
        font-size: 18px;
    }

    .nav-item {
        padding: 10px 16px;
        font-size: 14px;
    }

    .nav-section-title {
        font-size: 11px;
        padding: 6px 16px;
    }

    .user-name {
        font-size: 13px;
    }

    .user-tag {
        font-size: 11px;
    }

    /* Link items compact */
    .link-title {
        font-size: 15px;
    }

    .link-url {
        font-size: 13px;
        word-break: break-all;
    }

    .link-description {
        font-size: 13px;
    }

    /* Detail items compact */
    .detail-item label {
        font-size: 11px;
    }

    .detail-value {
        font-size: 15px;
    }

    /* Modal compact */
    .modal-header h3 {
        font-size: 16px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }

    .modal-content {
        max-height: 85vh;
    }
}
