/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3788d8;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 14px;
    --line-height-base: 1.5;
    --border-radius: 4px;
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--gray-900);
    background-color: var(--gray-100);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2rem; }

/* Calendar Styles */
.calendar-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-title {
    margin: 0;
    color: var(--gray-800);
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-nav {
    width: 35px;
    height: 35px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.view-buttons {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

#calendar {
    min-height: 600px;
}

/* Toast UI Calendar overrides */
.toastui-calendar {
    font-family: var(--font-family) !important;
}

.toastui-calendar-month-day-name {
    font-weight: 600;
    color: var(--gray-700);
}

.toastui-calendar-month-more-list {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Numéros de semaine */
.toastui-calendar-month {
    position: relative;
}

.toastui-calendar-month-day-names {
    position: relative;
}

.toastui-calendar-month-week-item {
    position: relative;
}

.week-number-header,
.week-number {
    user-select: none;
    z-index: 10;
}

.week-number-header {
    border-bottom: 1px solid var(--gray-300) !important;
}

.week-number:hover {
    background-color: var(--gray-200) !important;
}

/* Améliorations des événements Toast UI */
.toastui-calendar-event {
    border-radius: 3px !important;
    font-size: 12px !important;
    padding: 2px 4px !important;
    line-height: 1.2 !important;
}

.toastui-calendar-month-day-event {
    border-radius: 3px !important;
    font-size: 11px !important;
    padding: 1px 3px !important;
    margin-bottom: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.toastui-calendar-month-day-event:hover {
    opacity: 0.8 !important;
    cursor: pointer !important;
}

.toastui-calendar-month-day-event-title {
    font-weight: 500 !important;
}

/* Améliorer la lisibilité des dates */
.toastui-calendar-month-day-header {
    font-weight: 600 !important;
    color: var(--gray-800) !important;
}

/* Style pour les événements toute la journée */
.toastui-calendar-month-day-event[data-category="allday"] {
    background-color: rgba(55, 136, 216, 0.9) !important;
    border-left: 3px solid var(--primary-color) !important;
}

/* Style pour les événements avec heure */
.toastui-calendar-month-day-event[data-category="time"] {
    border-left: 3px solid transparent !important;
}

/* Améliorer l'affichage des jours du week-end */
.toastui-calendar-month-day.toastui-calendar-day-saturday,
.toastui-calendar-month-day.toastui-calendar-day-sunday {
    background-color: var(--gray-50) !important;
}

/* Améliorer l'affichage du jour actuel */
.toastui-calendar-month-day.toastui-calendar-day-today {
    background-color: rgba(55, 136, 216, 0.1) !important;
}

.toastui-calendar-month-day.toastui-calendar-day-today .toastui-calendar-month-day-header {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 2px !important;
}
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: darken(var(--primary-color), 10%);
    text-decoration: underline;
}

/* Forms */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--gray-700);
    background-color: var(--white);
    background-clip: padding-box;
    border: 1px solid var(--gray-400);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus {
    color: var(--gray-700);
    background-color: var(--white);
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(55, 136, 216, 0.25);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.form-row .form-group {
    flex: 1;
    padding: 0 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: #2c7ac7;
    border-color: #2a75be;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

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

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

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

/* Alerts */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

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

.login-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-links {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.login-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.login-links a:hover {
    text-decoration: underline;
}

.forgot-info {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-align: center;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-600);
    margin-bottom: 1rem;
}

/* Language selector on login page */
.login-language-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.language-dropdown {
    position: relative;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.language-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 150px;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s;
}

.language-item:hover {
    background: var(--gray-100);
}

/* Flags */
.flag {
    display: inline-block;
    width: 20px;
    height: 15px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
}

.flag-fr {
    background-image: linear-gradient(to right, #002395 33%, white 33% 66%, #ED2939 66%);
}

.flag-nl {
    background-image: linear-gradient(to bottom, #AE1C28 33%, white 33% 66%, #21468B 66%);
}

.flag-de {
    background-image: linear-gradient(to bottom, black 33%, #DD0000 33% 66%, #FFCE00 66%);
}

.flag-en {
    background: linear-gradient(
        to bottom,
        #B22234 0%, #B22234 7.7%,
        white 7.7%, white 15.4%,
        #B22234 15.4%, #B22234 23.1%,
        white 23.1%, white 30.8%,
        #B22234 30.8%, #B22234 38.5%,
        white 38.5%, white 46.2%,
        #B22234 46.2%, #B22234 53.8%,
        white 53.8%, white 61.5%,
        #B22234 61.5%, #B22234 69.2%,
        white 69.2%, white 76.9%,
        #B22234 76.9%, #B22234 84.6%,
        white 84.6%, white 92.3%,
        #B22234 92.3%, #B22234 100%
    );
    position: relative;
}

.flag-en::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 53.8%;
    background: #3C3B6E;
}

.dropdown-arrow {
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    transition: var(--transition);
}

.app-title {
    font-size: 1.25rem;
    margin: 0;
    color: var(--primary-color);
}

.header-center {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-email {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-email:hover {
    background: var(--gray-100);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a,
.user-dropdown button {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    transition: var(--transition);
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.app-sidebar {
    width: 250px;
    background: var(--white);
    border-right: 1px solid var(--gray-300);
    overflow-y: auto;
    padding: 1rem;
}

.compose-btn {
    width: 100%;
    margin-bottom: 1rem;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--gray-700);
}

.nav-link:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.nav-item.active .nav-link {
    background: var(--primary-color);
    color: var(--white);
}

.nav-link .icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.nav-link .badge {
    margin-left: auto;
    background: var(--danger-color);
    color: var(--white);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.folder-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-300);
}

/* Folder section within nav list */
.nav-list .folder-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: 2rem;
}

.nav-list .folder-list {
    margin-top: 0.25rem;
}

.folder-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-item {
    margin-bottom: 0.125rem;
}

.folder-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--gray-700);
    font-size: 0.875rem;
    text-decoration: none;
}

/* Folder links within nav list */
.nav-list .folder-link {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.folder-link:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.folder-item.active .folder-link {
    background: var(--gray-200);
    font-weight: 600;
}

.folder-count {
    background: var(--gray-500);
    color: var(--white);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.storage-info {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-300);
}

.storage-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.storage-used {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.storage-text {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-align: center;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    background: var(--gray-100);
}

/* Mail List */
.mail-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    padding: 0.75rem 1rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-link {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.page-info {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.mail-list {
    flex: 1;
    overflow-y: auto;
    background: var(--white);
}

.mail-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
    cursor: pointer;
    background: var(--gray-100);
}

.mail-item:hover {
    background: var(--gray-200);
}

.mail-item.unread {
    font-weight: 600;
    background: var(--white);
    border-left: 3px solid var(--primary-color);
}

.checkbox-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-right: 0.75rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    background: var(--white);
    border: 2px solid var(--gray-400);
    border-radius: 3px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--gray-600);
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.mail-star {
    font-size: 1.25rem;
    color: var(--gray-400);
    margin-right: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.mail-star:hover,
.mail-star.starred {
    color: var(--warning-color);
}

.mail-link {
    flex: 1;
    display: grid;
    grid-template-columns: 200px 1fr 100px;
    gap: 1rem;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.mail-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-preview {
    color: var(--gray-600);
    font-weight: 400;
    margin-left: 0.5rem;
}

.mail-date {
    text-align: right;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.attachment-icon {
    margin-left: 0.5rem;
    color: var(--gray-600);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    color: var(--gray-600);
}

/* Message View */
.message-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.message-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-300);
}

.message-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.message-subject {
    margin-bottom: 1rem;
}

.message-meta {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.message-meta > div {
    margin-bottom: 0.25rem;
}

.message-attachments {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.message-attachments h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
}

.attachment-icon {
    margin-right: 0.5rem;
}

.attachment-link {
    color: var(--primary-color);
}

.message-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.message-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: var(--font-family);
}

/* Compose */
.compose-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-300);
}

.compose-actions {
    display: flex;
    gap: 0.5rem;
}

.compose-fields {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.editor-btn {
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.editor-btn:hover {
    background: var(--white);
    border-color: var(--gray-400);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--gray-400);
    margin: 0 0.5rem;
}

.email-editor {
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    background: var(--white);
    outline: none;
}

.email-editor:focus {
    border-color: var(--primary-color);
}

.attachments-section {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
}

/* Contacts */
.contacts-container {
    padding: 1.5rem;
    background: var(--white);
    height: 100%;
    overflow-y: auto;
}

.contacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.contacts-actions {
    display: flex;
    gap: 0.5rem;
}

.contacts-search {
    margin-bottom: 1.5rem;
}

.contacts-search form {
    display: flex;
    gap: 0.5rem;
}

.contacts-search input {
    flex: 1;
    max-width: 400px;
}

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

.contacts-table th {
    text-align: left;
    padding: 0.75rem;
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
    font-weight: 600;
}

.contacts-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.contacts-table tr:hover {
    background: var(--gray-50);
}

.contacts-table .actions {
    text-align: right;
}

.contact-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--white);
}

.contact-form .form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Calendar */
.calendar-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--white);
}

#calendar {
    flex: 1;
    min-height: 500px;
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

/* FullCalendar customization */
.fc .fc-day-today {
    background-color: rgba(24, 100, 171, 0.1) !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    margin: 2px auto;
}

/* Simple calendar fallback */
.simple-calendar {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.simple-calendar h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--gray-800);
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-table th,
.calendar-table td {
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--gray-200);
}

.calendar-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
}

.calendar-table td {
    height: 60px;
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-table td:hover {
    background: var(--gray-50);
}

.calendar-table td.today {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    border-radius: 50%;
}

/* Calendar navigation */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.calendar-nav h3 {
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.nav-btn {
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
    min-width: 40px;
}

.nav-btn:hover {
    background: var(--primary-dark);
}

.month-select,
.year-select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    cursor: pointer;
    min-width: 120px;
}

.month-select:focus,
.year-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 100, 171, 0.2);
}

.year-select {
    min-width: 80px;
}

/* View buttons active state */
.view-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Week numbers column */
.week-number {
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
    width: 30px;
    border-right: 2px solid var(--gray-200);
}

/* Calendar days */
.calendar-day {
    position: relative;
    vertical-align: top;
    padding: 0.25rem;
    height: 80px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
}

.calendar-day:hover {
    background: var(--gray-50);
}

.calendar-day.other-month {
    color: var(--gray-400);
    background: var(--gray-50);
}

.calendar-day.today .day-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-weight: bold;
}

.day-number {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.day-events {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Week View */
.week-view-container {
    display: flex;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 1rem;
}

.time-column {
    width: 60px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
}

.time-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.time-slot {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.day-column {
    flex: 1;
    min-width: 0;
}

.day-column.today-column {
    background: rgba(24, 100, 171, 0.05);
}

.day-header {
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    border-left: 1px solid var(--gray-200);
}

.day-name {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
}

.day-date {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.hour-slot {
    height: 40px;
    border-bottom: 1px solid var(--gray-200);
    border-left: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background 0.2s;
}

.hour-slot:hover {
    background: rgba(24, 100, 171, 0.1);
}

/* Day View */
.day-view-container {
    display: flex;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 1rem;
    min-height: 600px;
}

.time-column-detailed {
    width: 80px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
}

.hour-group {
    height: 60px;
    border-bottom: 1px solid var(--gray-200);
}

.hour-label {
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--gray-600);
    background: var(--gray-100);
}

.half-hour-slot {
    height: 20px;
    border-bottom: 1px solid var(--gray-300);
    cursor: pointer;
    transition: background 0.2s;
}

.half-hour-slot:hover {
    background: rgba(24, 100, 171, 0.1);
}

.day-content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.day-events-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-events {
    color: var(--gray-500);
    font-style: italic;
    text-align: center;
}

/* List View */
.list-view-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-top: 1rem;
    overflow: hidden;
}

.events-list {
    padding: 1rem;
}

.day-events-list {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.day-events-list:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.day-events-list.today-events {
    background: rgba(24, 100, 171, 0.05);
    margin: 0 -1rem 1.5rem -1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.day-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.today-indicator {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.875rem;
}

.events-for-day {
    margin-left: 1rem;
}

.no-events-day {
    color: var(--gray-500);
    font-style: italic;
    margin: 0;
}

.add-event-section {
    padding: 1rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

/* Event display styles */
.calendar-event {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.all-day-event {
    font-weight: 500;
}

.hour-event {
    font-weight: 500;
}

.day-event-item {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.event-time {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
}

.event-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0.25rem 0;
}

.event-location {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0.25rem 0;
}

.event-description {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 0.25rem 0;
}

.list-event-item {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.list-event-item:hover {
    background: var(--gray-100);
}

.list-event-time {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 600;
}

.list-event-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.125rem 0;
}

.list-event-location {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-buttons {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    padding: 0.375rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.view-btn:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.view-btn:not(:first-child) {
    border-left: none;
}

.view-btn:hover {
    background: var(--gray-100);
}

.view-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

#calendar {
    flex: 1;
    min-height: 600px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-600);
}

.close:hover {
    color: var(--gray-900);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: "▼";
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    display: none;
    min-width: 160px;
    padding: 0.5rem 0;
    margin: 0.125rem 0 0;
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Align dropdown to right when in toolbar */
.toolbar-actions .dropdown-menu,
.dropdown-menu-right {
    left: auto;
    right: 0;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--gray-700);
    transition: var(--transition);
}

.dropdown-menu a:hover {
    background: var(--gray-100);
    text-decoration: none;
}

/* Footer */
.app-footer {
    background: var(--primary-color);
    border-top: none;
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--white);
}

.app-footer p {
    margin: 0;
    color: var(--white);
}

.login-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-top: none;
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--white);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.login-footer p {
    margin: 0;
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .header-center {
        display: none;
    }
    
    .app-sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .app-sidebar.open {
        left: 0;
    }
    
    .mail-link {
        grid-template-columns: 150px 1fr;
    }
    
    .mail-date {
        display: none;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-600); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }