/* ==========================================================================
   app.css — Shared Styles for heise Webchatbot
   ========================================================================== */

/* 1. CSS Reset & Base
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600&display=swap');

html {
    scrollbar-gutter: stable;
}

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

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #FCFCFD;
    min-height: 100vh;
    color: #14315B;
}

/* 2. Animated Background
   ========================================================================== */

.hero-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    opacity: 0.4;
    z-index: -1;
}

.hero-animation svg {
    width: 100%;
    height: 100%;
}

/* 3. Header & Navigation
   ========================================================================== */

.header {
    background: white;
    border-bottom: 1px solid #E5E9EE;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .logo a {
    display: flex;
    align-items: center;
}

.account-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #8A99AE;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.account-link:hover {
    background: #f3f4f6;
    color: #14315B;
}

.account-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

.account-link span {
    font-size: 0.875rem;
    font-weight: 500;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #8A99AE;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.logout-link:hover {
    background: #f3f4f6;
    color: #14315B;
}

.logout-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

.logout-link span {
    font-size: 0.875rem;
    font-weight: 500;
}

.hidden-until-auth {
    display: none !important;
}

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

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #14315B;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-nav-backdrop {
    display: none;
}

/* 4. Layout
   ========================================================================== */

.main-container {
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 5. Back Link
   ========================================================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #8A99AE;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: #64A4FF;
}

.back-link svg {
    width: 1rem;
    height: 1rem;
}

/* 6. Buttons
   ========================================================================== */

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #14315B;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #64A4FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 164, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #14315B;
    border: 2px solid #E5E9EE;
}

.btn-secondary:hover {
    border-color: #64A4FF;
    color: #64A4FF;
}

.btn-danger {
    background: white;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-delete {
    background: #dc2626;
    color: white;
}

.btn-delete:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* 7. Cards
   ========================================================================== */

.card {
    background: white;
    border: 1px solid #E5E9EE;
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #14315B;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #64A4FF;
}

/* 8. Forms
   ========================================================================== */

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #14315B;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E5E9EE;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: #14315B;
    background: white;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #64A4FF;
    box-shadow: 0 0 0 3px rgba(100, 164, 255, 0.1);
}

.form-input::placeholder {
    color: #8A99AE;
}

.form-hint {
    font-size: 0.75rem;
    color: #8A99AE;
    margin-top: 0.375rem;
}

/* 9. Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 49, 91, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #14315B;
    margin-bottom: 0.25rem;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: #8A99AE;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-icon {
    width: 3rem;
    height: 3rem;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.modal-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #dc2626;
}

.modal-text-center {
    text-align: center;
}

.modal-text {
    color: #8A99AE;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-text strong {
    color: #14315B;
}

/* 10. Messages
   ========================================================================== */

.message {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
}

.message.active {
    display: block;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* 11. Loading States
   ========================================================================== */

.loading-state {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #E5E9EE;
    border-top-color: #64A4FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #8A99AE;
    font-size: 0.875rem;
}

/* 12. Empty States
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #8A99AE;
}

.empty-state-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.75rem;
    color: #E5E9EE;
}

.empty-state-title {
    font-weight: 500;
    color: #14315B;
    margin-bottom: 0.25rem;
}

.empty-state-text {
    font-size: 0.875rem;
}

/* 13. Footer
   ========================================================================== */

.footer-inline {
    text-align: center;
    color: #8A99AE;
    font-size: 0.75rem;
    margin-top: 2rem;
}

.footer-inline a {
    color: #8A99AE;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-inline a:hover {
    color: #64A4FF;
}

/* 14. Utility
   ========================================================================== */

.hidden {
    display: none !important;
}

/* 15. Responsive / Mobile
   ========================================================================== */

@media (max-width: 767px) {
    .header .logo svg {
        width: 160px;
        height: 16px;
    }

    .hamburger {
        display: flex;
    }

    .header-nav {
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid #E5E9EE;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        padding: 0;
        z-index: 100;
    }

    .header-nav.active {
        max-height: 300px;
        padding: 0.5rem 0;
    }

    .header-nav .account-link,
    .header-nav .logout-link {
        padding: 0.75rem 1.5rem;
        min-height: 44px;
        width: 100%;
        border-radius: 0;
    }

    .header-nav .account-link:hover,
    .header-nav .logout-link:hover {
        background: #f3f4f6;
    }

    .header-nav-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99;
    }
}
