* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header>div {
    text-align: left;
}

header>div>div:first-child {
    text-align: center;
    flex: 1;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    display: flex;
    gap: 20px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.design-panel {
    width: 350px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.panel-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h2 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #667eea;
    font-weight: 600;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input[type="range"] {
    width: calc(100% - 60px);
    vertical-align: middle;
    margin-right: 10px;
}

.form-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.form-group span {
    display: inline-block;
    min-width: 50px;
    font-weight: 600;
    color: #667eea;
}

.canvas-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    min-height: 600px;
}

.canvas-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

#design-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px dashed #ddd;
}

.ad-panel {
    display: none;
    min-width: 250px;
    width: 300px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    color: #555;
}

.ad-panel-content {
    border-radius: 10px;
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ad-panel-image {
    flex: 2;
    background-image: url('/img/qr-auto.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ad-panel-text {
    flex: 1;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ad-panel-text span {
    font-size: 0.85em;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}


.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Scrollbar Styling */
.design-panel::-webkit-scrollbar {
    width: 8px;
}

.design-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.design-panel::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.design-panel::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .design-panel {
        width: 100%;
        max-height: none;
    }

    .ad-panel {
        display: none;
    }
}

@media (min-width: 1201px) {
    .ad-panel {
        display: block;
    }
}

@media (min-width: 1401px) {
    .ad-panel {
        width: 380px;
    }
}

/* Shared back link styles for AGB/Impressum */
.back-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
    vertical-align: middle;
    margin-right: 12px;
}

.back-arrow {
    display: inline-block;
    font-size: 64px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    vertical-align: text-top;
    position: relative;
    top: -10px;
    /* hebt den Pfeil sichtbar an */
}

/* Login Styles */
.btn-login {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Login Modal */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    /* Standard: versteckt */
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    margin: 0;
    padding: 0;
}

.login-modal[style*="flex"] {
    display: flex !important;
    /* Nur wenn explizit per JavaScript auf flex gesetzt */
}

.login-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    z-index: 10001;
}

/* Modal Close Button */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10002;
    padding: 0;
}

.modal-close-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

.modal-close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.app-modal-content .btn {
    width: auto;
    min-width: 115px;
    margin-bottom: 0;
}

.app-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.app-modal-input-wrapper input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.app-modal-input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-modal-header h2 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 10px;
}

.login-modal-header p {
    color: #666;
    font-size: 1em;
}

.login-modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.login-modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-modal-footer a {
    color: #667eea;
    text-decoration: none;
}

.login-modal-footer a:hover {
    text-decoration: underline;
}

/* Login Provider Buttons */
.btn-login-provider {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-login-provider:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.btn-google {
    border-color: #4285F4;
}

.btn-google:hover {
    background: #f8f9ff;
    border-color: #4285F4;
}

.btn-apple {
    border-color: #000;
}

.btn-apple:hover {
    background: #f5f5f5;
    border-color: #000;
}

/* Auth Error Message */
.auth-error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
    text-align: center;
}

/* Responsive Login */
@media (max-width: 768px) {
    header>div {
        flex-direction: column;
        gap: 15px;
    }

    header>div>div:first-child {
        text-align: center;
    }

    #user-info {
        width: 100%;
        justify-content: center;
    }

    .login-modal-content {
        padding: 30px 20px;
    }

    .login-modal-header h2 {
        font-size: 1.5em;
    }
}