body, html {
    margin: 0;
    overflow-x: hidden;
    width: 100%;
    font-family: "Trebuchet MS", Helvetica, Arial, sans-serif;
    word-break: break-word;
}

.layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    flex-direction: row;
    overflow-x: hidden;
    flex: 1;
}

.main-content {
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-x: hidden;
}

.contact-sidebar {
    position: relative;
    width: 20%;
    background: #007bff;
    border-left: 1px solid #2f00ff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    transition: width 0.3s ease;
    margin: 0px;
}

body.sidebar-collapsed {
    margin-right: 20px;
}

.contact-sidebar.collapsed {
    width: 10px;
    margin-right: 0px;
}

.contact-sidebar.collapsed .contact-infos,
.contact-sidebar.collapsed .contact-photo {
    display: none;
}

.toggle-btn {
    position: absolute;
    top: 10px;
    left: 5%;
    right: 95%;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
    z-index: 102;
}

.contact-photo {
    width: 80%;
    height: auto;
    aspect-ratio: 1/1;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 32px;
    margin-bottom: 18px;
    border: 2px solid #007bff;
    display: block;
}

.contact-infos {
    margin-top: 0;
    color: white;
}

.contact-infos h3 {
    margin-bottom: 12px;
    color: white;
}

html.dark-mode, body.dark-mode {
    background-color: #121212;
    color: black;
}

header {
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 24px;
    width: auto;
}

.tabs {
    display: flex;
    justify-content: space-between;
    background-color: white;
    height: fit-content;
    flex-wrap: nowrap;
    min-width: 0;
}

.tab-buttons {
    display: flex;
}

.dark-mode-label {
    background: #f4f4f4;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 22px;
    font-size: 16px;
    color: #007bff;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    white-space: nowrap;
}

.dark-mode-label:hover {
    background: #e3eaff;
    color: #0056b3;
}

#dark-mode-toggle {
    display: none;
}

#dark-mode-toggle:checked + .dark-mode-label {
    background: #007bff;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,123,255,0.08);
}

.tab-button {
    background: #f4f4f4;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 22px;
    font-size: 16px;
    color: #007bff;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.tab-button:hover {
    background: #e3eaff;
    color: #0056b3;
}

.tab-button.active {
    background: #007bff;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,123,255,0.08);
}

.tab-content {
    display: none;
    padding: 20px;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
}

body.dark-mode .tab-content, html.dark-mode .tab-content {
    background-color: #121212;
}

.tab-content.active {
    display: block;
}

.job, .education-item {
    margin-bottom: 20px;
}

.flip-card-front,
.flip-card-back,
.education-item {
    background-color: #f9f9f9;
    color: #222;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
}

#skills.tab-content.active {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

#skills .skills-block {
    flex: 1;
    min-width: 200px;
}

.flip-card {
    background-color: transparent;
    width: 100%;
    height: 200px;
    perspective: 1000px;
    margin-bottom: 20px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.flip-card-front::after {
    content: "Cliquez";
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.flip-card-back {
    transform: rotateY(180deg);
    text-align: center;
    justify-content: center;
    padding-top: 20px;
}

.flip-card-back p {
    margin: 5px 0;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    background-color: #f9f9f9;
    margin: 5px 0;
    padding: 10px;
    border-left: 5px solid #007bff;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #121212;
    color: #ffffff;
}

.dark-mode header {
    background-color: #1e1e1e;
}

.dark-mode .tabs {
    background-color: #1e1e1e;
}

.dark-mode .tab-button {
    background: #2e2e2e;
    color: #ffffff;
}

.dark-mode .tab-button:hover {
    background: #3e3e3e;
    color: #ffffff;
}

.dark-mode .tab-button.active {
    background: #007bff;
    color: #fff;
}

.dark-mode .tab-content {
    background-color: #121212;
    color: #ffffff;
}

.dark-mode .flip-card-front,
.dark-mode .flip-card-back,
.dark-mode .education-item {
    background-color: #232323;
    color: #fff;
    border: 1px solid #444;
    border-radius: 8px;
    text-align: center;
}

.dark-mode .flip-card-front::after {
    color: #ccc;
}

.dark-mode ul li {
    background-color: #232323;
    border-left: 5px solid #007bff;
    border-radius: 8px;
    border: 1px solid #444;
}

.dark-mode .dark-mode-label {
    background: #2e2e2e;
    color: #ffffff;
}

.dark-mode .dark-mode-label:hover {
    background: #3e3e3e;
}

.dark-mode #dark-mode-toggle:checked + .dark-mode-label {
    background: #007bff;
}

/* Responsive */
@media (max-width: 850px) {
    body,
    header {
        font-size: 16px;
    }
    .tab-buttons {
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
    }
    .dark-mode-label {
        margin-top: 10px;
        align-self: flex-start;
        padding: 8px 12px;
    }
    body.dark-mode .tabs {
        background: #1e1e1e;
    }
}

@media (max-width: 1000px) {
    .layout {
        flex-direction: row;
    }
    header, 
    .tabs{
        font-size: 14px;
        width: auto;
    }
    .tabs {
        flex-direction: column;
        display: flex;
        align-items: flex-start;
        background: #fff;
        border-radius: 0px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.07);
        margin: 0px;
        padding: 16px;
        border: 1px solid #e0e0e0;
    }
    .tab-buttons {
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
    }
    .tab-button {
        background: none;
        border: none;
        outline: none;
        cursor: pointer;
        padding: 14px 24px;
        font-size: 16px;
        color: #007bff;
        font-weight: 500;
        text-align: left;
        border-radius: 0 20px 20px 0;
        margin: 2px 0;
        transition: background 0.2s, color 0.2s, box-shadow 0.2s;
        position: relative;
        box-shadow: none;
    }
    .tab-button:hover {
        background: #e3eaff;
        color: #0056b3;
    }
    .tab-button.active {
        background: #007bff;
        color: #fff;
        font-weight: 600;
        box-shadow: 2px 0 8px -2px #007bff33;
    }
    header {
        display: flex;
        flex-direction: column;
    }
    body {
        margin-right: 0;
    }
    .contact-sidebar {
        position: relative;
        display: flex;
        height: auto;
        border-left: none;
        box-shadow: none;
        flex-direction: column;
        justify-content: top;
        background: #007bff;
        border-left: 1px solid #2f00ff;
    }
    .main-content {
        padding-right: 0;
        flex: 1;
    }
    .contact-sidebar.collapsed .contact-infos,
    .contact-sidebar.collapsed .contact-photo {
        display: none;
    }
    .toggle-btn {
        position: static;
        margin-right: 10px;
    }
    .contact-photo {
        position: static;
        margin-bottom: 0;
        margin: 16px;
        transform: none;
    }
    .contact-infos {
        text-align: left;
        margin-top: 0;
    }
    .flip-card-back {
        font-size: 14px;
    }
}

@media (max-width: 500px) {
    .flip-card-back {
        font-size: 10px;
    }
    .flip-card-front,.flip-card-front::after {
        font-size: 14px;
    }
}
@media (max-width: 350px) {
    .flip-card-back {
        font-size: 8px;
    }
    .flip-card-front,.flip-card-front::after {
        font-size: 10px;
    }
}

body.dark-mode .contact-sidebar {
    background: #232323;
    border-left: 1px solid #444;
}
body.dark-mode .contact-infos h3 {
    color: #66aaff;
}
body.dark-mode .contact-infos,
body.dark-mode .contact-sidebar {
    color: #fff;
}