/* style.css - Styles optimisés pour mobile */

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

:root {
    --primary: #4CAF50;
    --primary-dark: #45a049;
    --danger: #f44336;
    --danger-dark: #da190b;
    --secondary: #757575;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    background: white;
}

.header {
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.9rem;
}

.username {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-logout {
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-notifications {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    position: relative;
    padding: 5px;
}

.btn-admin {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    padding: 5px;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.btn-back {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.content {
    padding: 15px;
}

/* Boutons */
.btn {
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    touch-action: manipulation;
}

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

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

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

.btn-secondary:active {
    background: #616161;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:active {
    opacity: 1;
}

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    padding: 8px 16px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.btn-add:active {
    background: var(--primary-dark);
}

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.85rem;
}

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

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

.input-group {
    display: flex;
    margin-bottom: 10px;
}

.input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 1rem;
}

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

/* Autocomplétion */
.autocomplete-items {
    position: absolute;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    z-index: 99;
    width: calc(100% - 30px);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px var(--shadow);
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:active {
    background: var(--background);
}

/* Listes de courses */
.lists-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px var(--shadow);
}

.list-info {
    flex: 1;
    cursor: pointer;
}

.list-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-progress {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.list-actions {
    display: flex;
    gap: 5px;
}

.badge-shared {
    background: #2196F3;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Articles dans la liste */
.add-item-form {
    margin-bottom: 20px;
    position: relative;
}

.item-details {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.input-small {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

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

.items-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.items-section h3 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.item-card:active {
    background: var(--background);
}

.item-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.item-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.item-name {
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 500;
}

.item-quantity {
    font-size: 0.85rem;
    color: var(--primary);
}

.item-notes {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

.item-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-edit-item {
    color: #2196F3;
}

.item-checked {
    opacity: 0.6;
    background: var(--background);
}

.item-checked .item-name {
    text-decoration: line-through;
    color: var(--text-light);
}

.checked-section {
    border-top: 2px solid var(--border);
    padding-top: 15px;
    margin-top: 10px;
}

.btn-delete-item {
    color: var(--danger);
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal form {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-footer .btn {
    flex: 1;
}

/* Page de connexion */
.login-form {
    max-width: 400px;
    margin: 40px auto;
    padding: 20px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

.error-message {
    background: #ffebee;
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.success-message {
    background: #e8f5e9;
    color: var(--primary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.register-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
}

.register-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state p:first-child {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 0.9rem;
}

/* Notifications */
.notifications-actions {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.notification-card:active {
    background: var(--background);
}

.notification-card.unread {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-message {
    margin: 0 0 5px 0;
    color: var(--text);
    font-size: 0.95rem;
}

.notification-time {
    margin: 0;
    color: var(--text-light);
    font-size: 0.8rem;
}

.notification-unread-indicator {
    width: 10px;
    height: 10px;
    background: #2196F3;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.checked-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.btn-finish {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-finish:active {
    background: var(--primary-dark);
}

/* Page d'administration */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.user-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 4px var(--shadow);
}

.user-card.user-inactive {
    opacity: 0.6;
    background: var(--background);
}

.user-info {
    margin-bottom: 15px;
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.user-meta {
    font-size: 0.8rem;
    color: var(--text-light);
}

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

.badge-admin {
    background: #FF9800;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-inactive {
    background: #9E9E9E;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-you {
    background: #2196F3;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-warning {
    background: #FF9800;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-warning:active {
    background: #F57C00;
}

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

.btn-danger:active {
    background: var(--danger-dark);
}

/* Optimisations tactiles */
@media (hover: none) {
    .btn:hover,
    .btn-icon:hover {
        background: inherit;
    }
}

/* Amélioration de la lisibilité sur petits écrans */
@media (max-width: 360px) {
    .header h1 {
        font-size: 1.3rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .item-name {
        font-size: 1rem;
    }
}
