@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --primary-color: #10b981;
    --secondary-color: #059669;
    --accent-color: #34d399;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --sidebar-bg: rgba(15, 23, 42, 0.95);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --unread-bg: rgba(16, 185, 129, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.2) 0px, transparent 50%),
        radial-gradient(at 98% 1%, rgba(59, 130, 246, 0.2) 0px, transparent 50%),
        url('../../img/fond/fond.jpg'); /* Background image from prototype */
    background-size: cover;
    background-blend-mode: overlay;
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Barre de défilement personnalisée */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Éléments flottants */
.floating-shapes div {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
    z-index: -1;
    pointer-events: none;
}

.floating-shapes div:nth-child(1) {
    top: 20%;
    left: 10%;
    animation: float 8s infinite linear;
}

.floating-shapes div:nth-child(2) {
    top: 70%;
    right: 10%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border-color: var(--primary-color);
    opacity: 0.2;
    animation: float 12s infinite linear reverse;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* En-tête */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.9); /* Darker for better contrast */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 10px 20px;
    z-index: 100;
    height: 60px;
}

.left-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    width: 35px;
}

.logo h1 {
    font-size: 1.2rem;
    color: #fff;
    font-weight: 600;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-color);
    transition: 0.3s;
}

/* Barre de recherche */
.search-bar {
    flex: 0 1 500px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px 15px;
    transition: 0.3s;
}

.search-bar:focus-within {
    background: #fff;
    color: #333;
}

.search-bar ion-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    color: var(--text-muted);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.search-bar:focus-within ion-icon {
    color: #333;
}

.search-bar:focus-within input {
    color: #333;
}

/* Icônes en-tête droite */
.right-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: 0.3s;
    display: flex;
}

.icon-btn:hover {
    background: var(--hover-bg);
}

.profile-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
}

/* Mise en page */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Barre latérale */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.compose-btn {
    background: #fff;
    color: #333;
    border: none;
    padding: 12px 20px;
    border-radius: 15px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: 0.3s;
}

.compose-btn:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.compose-btn ion-icon {
    font-size: 1.2rem;
}

.sidebar ul {
    list-style: none;
    flex: 1;
}

.sidebar li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 0 20px 20px 0;
    margin-bottom: 5px;
}

.sidebar li a ion-icon {
    font-size: 1.2rem;
}

.sidebar li a:hover, .sidebar li a.active {
    background: var(--unread-bg);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--glass-border);
    border-radius: 2px;
    margin-top: 5px;
}

.progress {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Contenu principal */
main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.messages {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Barre d'outils */
.toolbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.5);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 4px;
    transition: 0.2s;
    display: flex;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Liste des messages */
.message-list {
    flex: 1;
    overflow-y: auto;
}

.message {
    display: grid;
    grid-template-columns: auto auto 200px 1fr 100px;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
    gap: 15px;
}

.message:hover {
    background: var(--hover-bg);
    box-shadow: inset 2px 0 0 var(--primary-color);
}

.message.unread {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-color);
    font-weight: 600;
}

.message.unread .sender, .message.unread .subject {
    color: #fff;
}

.message-checkbox {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.star {
    color: var(--text-muted);
    display: flex;
}

.star:hover {
    color: #ffd700;
}

.sender {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview {
    color: var(--text-muted);
    font-weight: 400;
}

.date {
    text-align: right;
    font-size: 0.85rem;
}

/* Bouton d'action flottant (Mobile) */
.fab-compose {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-size: 1.5rem;
    display: none; /* Hidden on desktop */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        z-index: 150;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }

    .search-bar {
        display: none; /* Masquer la recherche sur petit écran */
    }

    .message {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .star, .sender {
        display: none; /* Simplifier l'élément de liste sur mobile */
    }

    .fab-compose {
        display: flex;
    }
}

/* Notifications Toast */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-size: 0.95rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    animation: toastIn 0.3s forwards;
}

.toast.error {
    background: rgba(239, 68, 68, 0.9);
}

@keyframes toastIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}
