@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 50%, #dfe7eb 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #2d3748;
    padding: 30px 20px;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(71, 85, 105, 0.1);
    padding-bottom: 12px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: -0.5px;
}

.clear-history-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    color: #718096;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.clear-history-btn:hover {
    color: #e53e3e;
    background-color: rgba(229, 62, 62, 0.1);
    transform: scale(1.1);
}

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

.empty-history {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    margin-top: 30px;
    font-size: 13px;
    font-weight: 500;
}

.history-item {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-left: 4px solid #667eea;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.7);
    border-left-color: #764ba2;
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-date {
    font-size: 11px;
    color: #a0aec0;
    margin-bottom: 4px;
    font-weight: 500;
}

.history-item-preview {
    font-size: 13px;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.history-item-actions {
    display: flex;
    gap: 6px;
}

.history-view-btn,
.history-delete-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    color: #718096;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.history-view-btn:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    transform: scale(1.15);
}

.history-delete-btn:hover {
    color: #e53e3e;
    background-color: rgba(229, 62, 62, 0.1);
    transform: scale(1.15);
}

.history-delete-btn {
    color: #e53e3e;
}

/* ===== CONTAINER PRINCIPAL ===== */
.container {
    flex: 1;
    max-width: 900px;
    margin: auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 50px;
    overflow-y: auto;
    border-radius: 20px;
    margin: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

h1, h2 {
    margin-top: 0;
    color: #2d3748;
    font-weight: 700;
    letter-spacing: -0.5px;
}
/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.navbar h1 {
    margin: 0;
    flex: 1;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

.nav-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.nav-btn:active {
    transform: scale(0.98);
}

.home-btn {
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.2);
}

.home-btn:hover {
    color: #764ba2;
    border-color: #764ba2;
}

.qrcode-btn {
    color: #48bb78;
    border-color: rgba(72, 187, 120, 0.2);
}

.qrcode-btn:hover {
    color: #38a169;
    border-color: #38a169;
}

.navbar h1 {
    font-size: 28px;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 22px;
    margin-bottom: 20px;
}

.field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

select, textarea {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(71, 85, 105, 0.15);
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    color: #2d3748;
}

select::placeholder {
    color: #cbd5e0;
}

select {
    width: 180px;
    cursor: pointer;
    font-weight: 500;
}

select:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(102, 126, 234, 0.3);
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 0.9);
}

textarea {
    flex: 1;
    resize: vertical;
    min-height: 60px;
    font-weight: 400;
}

textarea:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(102, 126, 234, 0.3);
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

button {
    padding: 11px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

button:active {
    transform: scale(0.98);
}

button[type="button"]:not(.clear-history-btn):not(.history-view-btn):not(.history-delete-btn) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button[type="button"]:not(.clear-history-btn):not(.history-view-btn):not(.history-delete-btn):hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button[type="submit"]:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.buttons {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}

#addField {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

#addField:hover {
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
    transform: translateY(-2px);
}

#resultContainer {
    margin-top: 40px;
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 14px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#result {
    width: 100%;
    height: 200px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #2d3748;
    transition: all 0.3s ease;
    resize: vertical;
}

#result:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.result-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#copyBtn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
}

#copyBtn:hover {
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
    transform: translateY(-2px);
}

#saveToHistoryBtn {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
}

#saveToHistoryBtn:hover {
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.4);
    transform: translateY(-2px);
}

#clearResultBtn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

#clearResultBtn:hover {
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
    transform: translateY(-2px);
}

.hidden {
    display: none;
}

/* ===== SCROLLBAR PERSONNALISÉ ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        padding: 20px;
    }

    .container {
        max-width: 100%;
        padding: 25px;
        margin: 20px;
        border-radius: 16px;
    }

    .navbar {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        align-items: flex-start;
    }

    .navbar h1 {
        width: 100%;
        margin-bottom: 12px;
    }

    .nav-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .field-row {
        flex-direction: column;
        gap: 10px;
    }

    select {
        width: 100%;
    }

    .buttons {
        flex-direction: column;
        gap: 10px;
    }

    button {
        width: 100%;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    #result {
        height: 150px;
        font-size: 12px;
    }

    .result-buttons {
        flex-direction: column;
    }

    #copyBtn,
    #saveToHistoryBtn,
    #clearResultBtn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
        margin: 10px;
    }

    h1 {
        font-size: 20px;
    }

    button {
        padding: 10px 14px;
        font-size: 13px;
    }

    .sidebar {
        padding: 15px;
    }

    .sidebar-header h3 {
        font-size: 16px;
    }
}
