:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5f6fa;
    --text-color: #2c3e50;
    --bg-color: #ecf0f1;
    --card-bg: #ffffff;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

/* Thème Sombre */
body.dark-theme {
    --primary-color: #64b5f6;
    --secondary-color: #34495e;
    --text-color: #ecf0f1;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
}

/* Styles communs */
.card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.hidden {
    display: none !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    width: 100%;
}

.btn-primary:hover {
    background-color: #357abd;
}

.btn-secondary {
    background-color: var(--error-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}

/* Login Section */
#login-section {
    max-width: 400px;
    margin: 0 auto;
}

#login-section h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
}

.error-message {
    color: var(--error-color);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Links Section */
#links-section header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-bar {
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.link-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.link-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.link-icon-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.link-card span {
    font-weight: bold;
    font-size: 1.1rem;
}

.link-card .desc {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

/* Wrapper pour la carte et le bouton supprimer */
.link-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.link-card-wrapper .link-card {
    height: 100%;
    width: 100%;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(231, 76, 60, 0.1);
    color: var(--error-color);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.link-card-wrapper:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: var(--error-color);
    color: white;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions button {
    width: auto;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text-color);
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Styles du sélecteur de thème */
.theme-switch {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    gap: 5px;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.theme-switch button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    color: var(--text-color);
    transition: all 0.3s;
    font-size: 1rem;
}

.theme-switch button:hover {
    background-color: var(--secondary-color);
}

.theme-switch button.active {
    background-color: var(--primary-color);
    color: white;
}