/**
 * Download Gate for MailerLite - Frontend Styles
 */

/* Popup Overlay */
#dgml-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    animation: dgmlFadeIn 0.3s ease-out;
}

.dgml-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Popup Container */
.dgml-popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: dgmlSlideUp 0.3s ease-out;
}

/* Popup Header */
.dgml-popup-header {
    position: relative;
    padding: 24px 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.dgml-popup-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.dgml-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dgml-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.dgml-popup-close svg,
.dgml-popup-close svg * {
    width: 16px;
    height: 16px;
    fill: #ffffff;
    pointer-events: none;
}

/* Popup Body */
.dgml-popup-body {
    padding: 30px 24px;
}

.dgml-popup-message {
    margin: 0 0 24px;
    color: #4a5568;
    font-size: 15px;
    line-height: 1.6;
}

/* Form Styles */
#dgml-email-form {
    margin: 0;
}

.dgml-form-group {
    margin-bottom: 20px;
}

.dgml-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-size: 14px;
    font-weight: 500;
}

#dgml-email-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#dgml-email-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#dgml-email-input.dgml-error {
    border-color: #f56565;
    animation: dgmlShake 0.3s ease;
}

#dgml-email-input.dgml-success {
    border-color: #48bb78;
}

.dgml-error-message {
    display: block;
    margin-top: 8px;
    color: #f56565;
    font-size: 13px;
    min-height: 18px;
}

/* Submit Button */
.dgml-submit-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.dgml-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.dgml-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.dgml-submit-button.dgml-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dgmlSpin 1s linear infinite;
}

/* Skip Button - Simple text link style */
.dgml-skip-button {
    display: block;
    width: auto;
    margin: 15px auto 0;
    padding: 0;
    background: none;
    color: #a0aec0;
    font-size: 13px;
    font-weight: normal;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: underline;
    box-shadow: none;
    text-align: center;
}

.dgml-skip-button:hover {
    color: #718096;
    transform: none;
    box-shadow: none;
}

.dgml-skip-button span {
    display: inline;
}

.dgml-skip-button span::after {
    content: '';
    display: none;
}

/* Privacy Text */
.dgml-privacy-text {
    margin: 16px 0 0;
    padding: 12px;
    background: #f7fafc;
    border-radius: 6px;
    color: #718096;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

/* Success Message */
.dgml-success-message {
    text-align: center;
    padding: 20px;
    animation: dgmlFadeIn 0.3s ease;
}

.dgml-success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: #48bb78;
    border-radius: 50%;
    padding: 15px;
}

.dgml-success-icon path {
    fill: #ffffff;
}

.dgml-success-message p {
    margin: 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 500;
}

/* Body Scroll Lock */
body.dgml-popup-open {
    overflow: hidden;
}

/* Animations */
@keyframes dgmlFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes dgmlSlideUp {
    from {
        transform: translate(-50%, -40%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

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

@keyframes dgmlSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 640px) {
    .dgml-popup-container {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
    }

    .dgml-popup-header {
        padding: 20px 20px 16px;
    }

    .dgml-popup-header h3 {
        font-size: 20px;
        padding-right: 30px;
    }

    .dgml-popup-close {
        top: 16px;
        right: 16px;
        width: 28px;
        height: 28px;
    }

    .dgml-popup-body {
        padding: 24px 20px;
    }

    .dgml-popup-message {
        font-size: 14px;
        margin-bottom: 20px;
    }

    #dgml-email-input {
        padding: 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .dgml-submit-button {
        padding: 12px 20px;
        font-size: 15px;
    }

    .dgml-skip-button {
        font-size: 12px;
    }

    .dgml-privacy-text {
        font-size: 12px;
        padding: 10px;
    }
}

/* Small Desktop/Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .dgml-popup-container {
        max-width: 420px;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .dgml-popup-container {
        background: #1a202c;
    }

    .dgml-popup-header {
        background: linear-gradient(135deg, #4c51bf 0%, #805ad5 100%);
    }

    .dgml-popup-message {
        color: #cbd5e0;
    }

    .dgml-form-group label {
        color: #e2e8f0;
    }

    #dgml-email-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #ffffff;
    }

    #dgml-email-input:focus {
        border-color: #805ad5;
        box-shadow: 0 0 0 3px rgba(128, 90, 213, 0.2);
    }

    .dgml-skip-button {
        background: none;
        color: #718096;
        text-decoration: underline;
        box-shadow: none;
    }

    .dgml-skip-button:hover {
        color: #4a5568;
        box-shadow: none;
    }

    .dgml-privacy-text {
        background: #2d3748;
        color: #a0aec0;
    }

    .dgml-success-message p {
        color: #e2e8f0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .dgml-popup-container {
        border: 2px solid #000000;
    }

    #dgml-email-input {
        border-width: 3px;
    }

    .dgml-submit-button {
        border: 2px solid #ffffff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .dgml-popup-container,
    #dgml-popup,
    .dgml-submit-button,
    .dgml-popup-close {
        animation: none !important;
        transition: none !important;
    }
}