/* GT Request Manager - Frontend Styles */

:root {
    --gtrm-primary: #0066cc;
    --gtrm-primary-dark: #0052a3;
    --gtrm-success: #00cc66;
    --gtrm-danger: #ff3b30;
    --gtrm-dark: #1a1a1a;
    --gtrm-dark-light: #2a2a2a;
    --gtrm-border: #3a3a3a;
    --gtrm-text: #ffffff;
    --gtrm-text-muted: #999999;
    --gtrm-glass-bg: rgba(255, 255, 255, 0.05);
    --gtrm-glass-border: rgba(255, 255, 255, 0.1);
}

/* Form Wrapper */
.gtrm-form-wrapper {
    display: inline-block;
}

.gtrm-open-modal-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--gtrm-primary) 0%, var(--gtrm-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.3);
}

.gtrm-open-modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.4);
}

.gtrm-open-modal-btn:active {
    transform: translateY(-1px);
}

/* Modal */
.gtrm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647;
    animation: gtrm-fadeIn 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    isolation: isolate;
}

.gtrm-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes gtrm-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gtrm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(20px);
    z-index: 2147483646;
    pointer-events: all;
}

.gtrm-modal-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--gtrm-dark);
    border: 1px solid var(--gtrm-glass-border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 2147483647;
    pointer-events: all;
}

@keyframes gtrm-slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.gtrm-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gtrm-glass-bg);
    backdrop-filter: blur(10px);
    color: var(--gtrm-text);
    font-size: 22px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.gtrm-modal-close:hover {
    background: var(--gtrm-danger);
    transform: rotate(90deg);
}

.gtrm-modal-header {
    background: linear-gradient(135deg, var(--gtrm-dark-light) 0%, var(--gtrm-dark) 100%);
    padding: 20px 30px;
    border-bottom: 1px solid var(--gtrm-border);
}

.gtrm-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.gtrm-logo-icon {
    font-size: 24px;
}

.gtrm-logo h2 {
    margin: 0;
    color: var(--gtrm-text);
    font-size: 18px;
}

/* Progress Bar */
.gtrm-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.gtrm-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
    z-index: 2;
}

.gtrm-progress-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--gtrm-dark);
    border: 2px solid var(--gtrm-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--gtrm-text-muted);
    transition: all 0.3s ease;
    font-size: 14px;
}

.gtrm-progress-step.active .gtrm-progress-circle {
    background: var(--gtrm-primary);
    border-color: var(--gtrm-primary);
    color: white;
    box-shadow: 0 0 15px rgba(0, 102, 204, 0.5);
    transform: scale(1.1);
}

.gtrm-progress-step span {
    font-size: 11px;
    color: var(--gtrm-text-muted);
    font-weight: 600;
}

.gtrm-progress-step.active span {
    color: var(--gtrm-primary);
}

.gtrm-progress-line {
    position: absolute;
    top: 17px;
    left: calc(33.33% + 17px);
    width: calc(33.33% - 34px);
    height: 2px;
    background: var(--gtrm-border);
    z-index: 1;
}

.gtrm-progress-line:nth-of-type(2) {
    left: calc(66.66% + 17px);
}

/* Modal Body */
.gtrm-modal-body {
    padding: 30px;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.gtrm-modal-body::-webkit-scrollbar {
    width: 8px;
}

.gtrm-modal-body::-webkit-scrollbar-track {
    background: var(--gtrm-dark);
}

.gtrm-modal-body::-webkit-scrollbar-thumb {
    background: var(--gtrm-border);
    border-radius: 4px;
}

.gtrm-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gtrm-primary);
}

/* Form Steps */
/* Step Animations */
.gtrm-form-step {
    display: none;
}

.gtrm-form-step.active {
    display: block;
}

/* Step Fade Animation */
.gtrm-form-step.active.gtrm-step-fade {
    animation: gtrmStepFadeIn 0.5s ease;
}

@keyframes gtrmStepFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Step Slide Animation */
.gtrm-form-step.active.gtrm-step-slide {
    animation: gtrmStepSlideIn 0.5s ease;
}

@keyframes gtrmStepSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Step Zoom Animation */
.gtrm-form-step.active.gtrm-step-zoom {
    animation: gtrmStepZoomIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gtrmStepZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gtrm-step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    color: var(--gtrm-text);
    font-size: 20px;
}

.gtrm-step-icon {
    font-size: 28px;
}

/* Form Groups */
.gtrm-form-group {
    margin-bottom: 12px;
}

.gtrm-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gtrm-text);
    font-weight: 600;
    font-size: 15px;
}

.required {
    color: var(--gtrm-danger);
}

.gtrm-form-group input,
.gtrm-form-group textarea,
.gtrm-form-group select {
    width: 100%;
    height: 48px;
    padding: 12px 15px;
    background: var(--gtrm-dark-light);
    border: 1px solid var(--gtrm-border);
    border-radius: 8px;
    color: var(--gtrm-text);
    font-size: 16px !important;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.gtrm-form-group input:focus,
.gtrm-form-group textarea:focus,
.gtrm-form-group select:focus {
    outline: none;
    border-color: var(--gtrm-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.gtrm-form-group input::placeholder,
.gtrm-form-group textarea::placeholder {
    color: var(--gtrm-text-muted);
}

.gtrm-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* File Upload */
.gtrm-file-upload {
    margin-top: 10px;
}

.gtrm-file-input {
    display: none;
}

.gtrm-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    background: var(--gtrm-glass-bg);
    border: 2px dashed var(--gtrm-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-direction: column;
}

.gtrm-file-label:hover {
    border-color: var(--gtrm-primary);
    background: rgba(0, 102, 204, 0.05);
}

.gtrm-file-icon {
    font-size: 48px;
}

.gtrm-file-text {
    color: var(--gtrm-text);
    font-weight: 600;
}

.gtrm-file-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.gtrm-file-preview-item {
    position: relative;
    width: 100%;
    padding-top: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gtrm-border);
}

.gtrm-file-preview-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gtrm-file-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: var(--gtrm-danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.gtrm-file-preview-remove:hover {
    transform: scale(1.1);
}

/* Privacy Notice */
.gtrm-privacy-notice {
    margin-top: 25px;
    padding: 15px;
    background: var(--gtrm-glass-bg);
    border: 1px solid var(--gtrm-border);
    border-radius: 8px;
}

.gtrm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gtrm-text);
    line-height: 1.6;
}

.gtrm-checkbox-label input[type="checkbox"] {
    width: auto;
    height: auto;
    flex-shrink: 0;
    cursor: pointer;
}

.gtrm-checkbox-label a {
    color: var(--gtrm-primary);
    text-decoration: none;
}

.gtrm-checkbox-label a:hover {
    text-decoration: underline;
}

/* Form Navigation */
.gtrm-form-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gtrm-border);
}

.gtrm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.gtrm-btn-primary {
    background: var(--gtrm-primary);
    color: white;
    margin-left: auto;
}

.gtrm-btn-primary:hover {
    background: var(--gtrm-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.gtrm-btn-secondary {
    background: var(--gtrm-dark-light);
    color: var(--gtrm-text);
    border: 1px solid var(--gtrm-border);
}

.gtrm-btn-secondary:hover {
    background: var(--gtrm-border);
}

.gtrm-btn-success {
    background: var(--gtrm-success);
    color: white;
    margin-left: auto;
}

.gtrm-btn-success:hover {
    background: #00b359;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 102, 0.3);
}

.gtrm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gtrm-btn-icon {
    font-size: 18px;
    line-height: 1;
}

/* Form Messages */
.gtrm-form-message {
    text-align: center;
    padding: 40px;
    animation: gtrm-fadeIn 0.4s ease;
}

.gtrm-success-icon,
.gtrm-error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
}

.gtrm-form-success .gtrm-success-icon {
    background: var(--gtrm-success);
    color: white;
}

.gtrm-form-error .gtrm-error-icon {
    background: var(--gtrm-danger);
    color: white;
}

.gtrm-form-message h3 {
    margin: 0 0 15px;
    color: var(--gtrm-text);
    font-size: 24px;
}

.gtrm-form-message p {
    margin: 0;
    color: var(--gtrm-text-muted);
    line-height: 1.6;
}

/* Loading Spinner */
.gtrm-loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999999;
}

.gtrm-loading.active {
    display: block;
}

.gtrm-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gtrm-border);
    border-top-color: var(--gtrm-primary);
    border-radius: 50%;
    animation: gtrm-spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    /* Prevent iOS Safari auto-zoom */
    * {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    .gtrm-open-modal-btn {
        padding: 12px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 10px;
        letter-spacing: 0.5px;
    }
    
    .gtrm-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .gtrm-modal-header {
        padding: 6px 12px;
    }
    
    .gtrm-modal-body {
        padding: 8px;
        max-height: calc(95vh - 80px);
    }
    
    .gtrm-modal-close {
        width: 26px;
        height: 26px;
        font-size: 18px;
        top: 6px;
        right: 6px;
    }
    
    .gtrm-logo h2 {
        font-size: 14px;
    }
    
    .gtrm-logo-icon {
        font-size: 18px;
    }
    
    .gtrm-logo {
        margin-bottom: 8px !important;
    }
    
    .gtrm-progress-step span {
        font-size: 9px;
    }
    
    .gtrm-progress-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .gtrm-progress-line {
        top: 13px;
        left: calc(33.33% + 14px);
        width: calc(33.33% - 28px);
    }
    
    .gtrm-progress-line:nth-of-type(2) {
        left: calc(66.66% + 16px);
    }
    
    .gtrm-form-row {
        grid-template-columns: 1fr;
    }
    
    /* EXTREM kleine Zeilenabstände auf Mobile */
    .gtrm-step-title {
        margin-bottom: 6px !important;
        font-size: 15px;
        gap: 4px;
    }
    
    .gtrm-step-icon {
        font-size: 18px;
    }
    
    .gtrm-form-group {
        margin-bottom: 2px !important;
    }
    
    .gtrm-form-group label {
        font-size: 14px;
        margin-bottom: 2px !important;
    }
    
    .gtrm-form-row {
        margin-bottom: 0 !important;
    }
    
    .gtrm-form-group input,
    .gtrm-form-group textarea {
        font-size: 16px !important;
        height: 38px;
        padding: 6px 10px;
    }
    
    /* Fix anrede dropdown on mobile */
    .gtrm-form-row .gtrm-form-group:first-child {
        width: 100%;
    }
    
    .gtrm-form-group select {
        min-width: 100%;
        height: 40px;
        font-size: 16px;
        padding: 8px 10px;
        line-height: 1.5;
    }
    
    .gtrm-form-navigation {
        flex-direction: column;
        margin-top: 8px !important;
    }
    
    .gtrm-btn-primary,
    .gtrm-btn-success {
        margin-left: 0;
        padding: 10px 20px !important;
        font-size: 16px !important;
    }
}

/* Modal Animations */
/* Animation Classes - Apply to entire modal */
.gtrm-modal.gtrm-animation-fade.active {
    animation: gtrmModalFadeIn 0.6s ease-out;
}

.gtrm-modal.gtrm-animation-fade.gtrm-closing {
    animation: gtrmModalFadeOut 0.5s ease-out;
}

.gtrm-modal.gtrm-animation-slide.active .gtrm-modal-container {
    animation: gtrmSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.gtrm-modal.gtrm-animation-slide.gtrm-closing .gtrm-modal-container {
    animation: gtrmSlideDown 0.5s ease-in;
}

.gtrm-modal.gtrm-animation-zoom.active .gtrm-modal-container {
    animation: gtrmZoomIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gtrm-modal.gtrm-animation-zoom.gtrm-closing .gtrm-modal-container {
    animation: gtrmZoomOut 0.5s ease-in;
}

.gtrm-modal.gtrm-animation-none.active {
    animation: none;
}

/* Overlay fade for all animations */
.gtrm-modal.active .gtrm-modal-overlay {
    animation: gtrmOverlayFadeIn 0.5s ease-out;
}

.gtrm-modal.gtrm-closing .gtrm-modal-overlay {
    animation: gtrmOverlayFadeOut 0.5s ease-out;
}

/* Keyframes */
@keyframes gtrmModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes gtrmModalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes gtrmFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes gtrmFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes gtrmSlideUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gtrmSlideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(100px);
    }
}

@keyframes gtrmZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes gtrmZoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

@keyframes gtrmOverlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes gtrmOverlayFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Desktop: Wider modal + 3-column layout + external nav buttons */
@media (min-width: 769px) {
    .gtrm-modal-container {
        max-width: 1200px;
        z-index: 1000001;
    }
    
    .gtrm-modal-overlay {
        z-index: 1000000;
    }
    
    /* 3-column layout for name row */
    .gtrm-row-3col {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    /* 2-column layout for city/phone and other pairs */
    .gtrm-row-2col {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Single column for anrede */
    .gtrm-row-single {
        max-width: 250px;
    }
    
    /* Make navigation buttons slimmer */
    .gtrm-form-navigation {
        display: flex;
        gap: 15px;
        justify-content: space-between;
        padding: 20px 30px;
    }
    
    .gtrm-btn-prev,
    .gtrm-btn-next,
    .gtrm-btn-submit {
        height: 42px !important;
        padding: 0 24px !important;
        font-size: 14px !important;
        line-height: 1 !important;
    }
}

/* Additional security: Hide all website content when modal is open */
body.gtrm-modal-open > *:not(#gtrm-modal):not(script):not(style) {
    visibility: hidden !important;
    pointer-events: none !important;
}

body.gtrm-modal-open #gtrm-modal {
    visibility: visible !important;
    pointer-events: all !important;
}

/* Button Attraction Animations */
@keyframes gtrm-shake-light {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes gtrm-shake-medium {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes gtrm-shake-strong {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) rotate(-2deg); }
    20%, 40%, 60%, 80% { transform: translateX(8px) rotate(2deg); }
}

@keyframes gtrm-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes gtrm-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 102, 204, 0.3),
                    0 0 10px rgba(0, 102, 204, 0.2);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 102, 204, 0.6),
                    0 0 25px rgba(0, 102, 204, 0.4),
                    0 0 35px rgba(0, 102, 204, 0.2);
    }
}

@keyframes gtrm-combo {
    0%, 100% {
        transform: translateX(0) scale(1);
        box-shadow: 0 0 5px rgba(0, 102, 204, 0.3),
                    0 0 10px rgba(0, 102, 204, 0.2);
    }
    25% {
        transform: translateX(-5px) scale(1.05);
        box-shadow: 0 0 15px rgba(0, 102, 204, 0.6),
                    0 0 25px rgba(0, 102, 204, 0.4);
    }
    75% {
        transform: translateX(5px) scale(1.05);
        box-shadow: 0 0 15px rgba(0, 102, 204, 0.6),
                    0 0 25px rgba(0, 102, 204, 0.4);
    }
}

/* Animation Classes */
.gtrm-attract-shake-light {
    animation: gtrm-shake-light 0.5s ease-in-out;
}

.gtrm-attract-shake-medium {
    animation: gtrm-shake-medium 0.6s ease-in-out;
}

.gtrm-attract-shake-strong {
    animation: gtrm-shake-strong 0.7s ease-in-out;
}

.gtrm-attract-pulse {
    animation: gtrm-pulse 0.6s ease-in-out;
}

.gtrm-attract-glow {
    animation: gtrm-glow 0.8s ease-in-out;
}

.gtrm-attract-combo {
    animation: gtrm-combo 0.8s ease-in-out;
}

/* iOS-specific fix to prevent auto-zoom */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }
    
    .gtrm-form-group input,
    .gtrm-form-group textarea,
    .gtrm-form-group select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}
