/* ═══════════════════════════════════════════
   WPM Magazine Downloader — Frontend Styles
   ═══════════════════════════════════════════ */

/* ── Variables ── */
:root {
    --wpm-md-navy:       #0D0B3F;
    --wpm-md-navy-light: #1A1750;
    --wpm-md-gold:       #FFD700;
    --wpm-md-gold-hover: #FFC300;
    --wpm-md-bg:         #f5f5f7;
    --wpm-md-text:       #333;
    --wpm-md-white:      #fff;
    --wpm-md-border:     #e6e6ea;
    --wpm-md-radius:     12px;
    --wpm-md-shadow:     0 8px 32px rgba(13, 11, 63, 0.12);
    --wpm-md-font:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --wpm-md-font-head:  'Oswald', sans-serif;
}

/* ═══════════════════
   Magazine Grid
   ═══════════════════ */

.wpm-md-grid {
    display: grid;
    grid-template-columns: repeat(var(--wpm-md-cols, 3), 1fr);
    gap: 28px;
    padding: 20px 0;
}

@media (max-width: 900px) {
    .wpm-md-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .wpm-md-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════
   Magazine Card
   ═══════════════════ */

.wpm-md-card {
    position: relative;
    background: var(--wpm-md-white);
    border-radius: var(--wpm-md-radius);
    overflow: hidden;
    box-shadow: var(--wpm-md-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.wpm-md-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(13, 11, 63, 0.18);
}

/* Cover image */
.wpm-md-card__cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: linear-gradient(135deg, var(--wpm-md-navy), var(--wpm-md-navy-light));
}

.wpm-md-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.wpm-md-card:hover .wpm-md-card__cover img {
    transform: scale(1.05);
}

/* Issue badge */
.wpm-md-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--wpm-md-gold);
    color: var(--wpm-md-navy);
    font-family: var(--wpm-md-font-head);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Card body */
.wpm-md-card__body {
    padding: 20px 20px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.wpm-md-card__date {
    font-family: var(--wpm-md-font);
    font-size: 12px;
    font-weight: 600;
    color: var(--wpm-md-gold);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.wpm-md-card__title {
    font-family: var(--wpm-md-font-head);
    font-size: 18px;
    font-weight: 600;
    color: var(--wpm-md-navy);
    line-height: 1.3;
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Download button */
.wpm-md-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--wpm-md-navy), var(--wpm-md-navy-light));
    color: var(--wpm-md-gold) !important;
    font-family: var(--wpm-md-font-head);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.wpm-md-card__btn:hover {
    background: linear-gradient(135deg, var(--wpm-md-gold), var(--wpm-md-gold-hover));
    color: var(--wpm-md-navy) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
}

.wpm-md-card__btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}


/* ═══════════════════
   Download Modal
   ═══════════════════ */

.wpm-md-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(13, 11, 63, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wpm-md-overlay.is-active {
    display: flex;
}

.wpm-md-overlay.is-visible {
    opacity: 1;
}

/* Modal card */
.wpm-md-modal {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: var(--wpm-md-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wpm-md-overlay.is-visible .wpm-md-modal {
    transform: translateY(0) scale(1);
}

/* Close button */
.wpm-md-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: var(--wpm-md-white);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.wpm-md-modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal header */
.wpm-md-modal__header {
    background: linear-gradient(135deg, var(--wpm-md-navy) 0%, var(--wpm-md-navy-light) 100%);
    padding: 32px 32px 28px;
    text-align: center;
}

.wpm-md-modal__icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.wpm-md-modal__title {
    font-family: var(--wpm-md-font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--wpm-md-white);
    margin: 0 0 4px;
    line-height: 1.3;
}

.wpm-md-modal__subtitle {
    font-family: var(--wpm-md-font);
    font-size: 13px;
    color: var(--wpm-md-gold);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

/* Modal body / form */
.wpm-md-modal__body {
    padding: 28px 32px 32px;
}

.wpm-md-form-group {
    margin-bottom: 18px;
}

.wpm-md-form-group label {
    display: block;
    font-family: var(--wpm-md-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--wpm-md-navy);
    margin-bottom: 6px;
}

.wpm-md-form-group input {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--wpm-md-font);
    font-size: 15px;
    color: var(--wpm-md-text);
    border: 2px solid var(--wpm-md-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: var(--wpm-md-white);
}

.wpm-md-form-group input:focus {
    border-color: var(--wpm-md-gold);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

.wpm-md-form-group input.is-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Submit button */
.wpm-md-submit {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--wpm-md-gold), var(--wpm-md-gold-hover));
    color: var(--wpm-md-navy) !important;
    font-family: var(--wpm-md-font-head);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.wpm-md-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.wpm-md-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.wpm-md-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(13, 11, 63, 0.2);
    border-top-color: var(--wpm-md-navy);
    border-radius: 50%;
    animation: wpmMdSpin 0.7s linear infinite;
}

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

.wpm-md-submit.is-loading .wpm-md-spinner { display: inline-block; }
.wpm-md-submit.is-loading .wpm-md-submit-text { display: none; }

/* Disclaimer */
.wpm-md-disclaimer {
    font-family: var(--wpm-md-font);
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 14px;
    line-height: 1.5;
}

/* Error / success messages */
.wpm-md-msg {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--wpm-md-font);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.wpm-md-msg--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.wpm-md-msg--success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Success state — hide form, show success */
.wpm-md-modal__body.is-success .wpm-md-form { display: none; }

.wpm-md-success {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.wpm-md-modal__body.is-success .wpm-md-success {
    display: block;
}

.wpm-md-success__icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.wpm-md-success__title {
    font-family: var(--wpm-md-font-head);
    font-size: 24px;
    font-weight: 700;
    color: var(--wpm-md-navy);
    margin: 0 0 8px;
}

.wpm-md-success__text {
    font-family: var(--wpm-md-font);
    font-size: 15px;
    color: #555;
    margin: 0 0 24px;
    line-height: 1.6;
}

.wpm-md-success__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--wpm-md-navy), var(--wpm-md-navy-light));
    color: var(--wpm-md-gold) !important;
    font-family: var(--wpm-md-font-head);
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.3s ease;
}

.wpm-md-success__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 11, 63, 0.3);
}


/* ═══════════════════
   Responsive
   ═══════════════════ */

@media (max-width: 480px) {
    .wpm-md-modal {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    .wpm-md-modal__header {
        padding: 24px 20px 20px;
    }

    .wpm-md-modal__body {
        padding: 20px;
    }

    .wpm-md-modal__title {
        font-size: 18px;
    }
}
