/* --- Global Reset & Base --- */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    overflow: hidden; /* Keep extension popup from scrolling */
}
body {
    width: 420px;
    height: 470px;
    display: flex;
    justify-content: center;
    position: relative;
    background: #ffffff;
}

/* --- Doodles & Wave Background --- */
.popup-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 420px; /* Match body width */
    height: 600px; /* Match body height */
    overflow: hidden;
    z-index: 1;
}

/* Wave shape at top */
.popup-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 420px;
    height: 220px;
    z-index: 2;
}

/* Doodles */
.doodle {
    position: absolute;
    width: 420px;
    opacity: 0.15;
    z-index: 1;
}

/* --- Loading Overlay --- */
.loading-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 420px;
    height: 600px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 999;
}
.loading-container img {
    width: 60px;
    height: 60px;
    animation: fadeIn 0.5s ease-in-out infinite alternate;
}

/* --- Popup Container (on top of wave) --- */
.popup-container {
    position: relative;
    z-index: 10;
    width: 380px;
    border-radius: 20px;
    margin: auto; /* space from wave */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.8s ease forwards;
}

/* --- Header --- */
.popup-header {
    position: relative;
    text-align: center;
    padding: 12px;
}

.popup-logo {
    width: 140px;
    height: auto;
    animation: bounce 2s ease-in-out;
}
.popup-logo:hover {
    animation: bounce 2s infinite;
}
/* Profile settings icon in top-right corner */
.profile-settings {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: url('assets/default-profile.png') no-repeat center center;
    background-size: cover;
    cursor: pointer;
    display: none; /* shown only on login */
}

/* --- Main Content --- */
#mainContent {
    padding: 16px;
    text-align: center;
}

/* --- Login Prompt --- */
.login-prompt h2 {
    font-size: 24px;
    color: #ea6925;
    margin-bottom: 12px;
}
.login-prompt p {
    font-size: 14px !important;
    color: #444;
    margin-bottom: 16px;
}
.login-prompt a {
    color: #ea6925;
    text-decoration: none;
}
.login-button {
    background: #ea6925;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* --- Profile Card --- */
.profile-card {
    padding: 16px;
}
.profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.welcome-message {
    font-size: 18px;
    color: #ea6925;
    margin-top: 12px;
    font-weight: bold;
}
.username {
    font-size: 14px;
    color: #555;
    margin-bottom: 16px;
}
.profile-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}
.settings-button,
.logout-button {
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.settings-button {
    background: #ea6925;
    color: #fff;
}
.logout-button {
    border: 1px solid #ea6925;
    color: #ea6925;
}
.settings-button:hover {
    background: #da7f52;
}
.logout-button:hover {
    background: #ea6925;
    color: #fff;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-prompt {
    max-width: 250px;
    margin: 0 auto;
    text-align: center;
    font-family: sans-serif;
}

.login-prompt h2 {
    margin: 0 0 10px;
    font-size: 1.5em;
}

.login-prompt p {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 6px;
    margin-top: 5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.login-form label {
    text-align: left;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.8rem;
    color: #444;
}

.login-form input {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
    font-size: 1rem;
    outline: none;
}
.login-form div {
    display: flex;
    flex-direction: column;
}

.login-form input:focus {
    border-color: #ea6925; /* highlight border on focus */
}

.login-button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    background-color: #ea6925;
    color: #fff;
    transform: scale(1);
    transition: 0.3s;
}

.login-button:hover {
    transform: scale(1.05);
}

.error-message {
    padding: 8px;
    margin: 8px 0;
    border: 1px solid #cc0000;
    border-radius: 4px;
    background-color: #f8d7da; /* light red background */
    color: #721c24; /* darker red text */
}

.mt-6 {
    margin-top: 6px;
}

/* -------------- Overall Card -------------- */
.coupons-profile-card {
    /* Subtle gradient with your brand color (#ea6925) in mind */
    background: linear-gradient(135deg, #fff 50%, #fff3ec 100%);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    animation: fadeInUp 0.3s ease forwards;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* Optional fade-in keyframe for the card */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------------- Header / Profile Row -------------- */
.coupons-profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.coupons-profile-info {
    display: flex;
    align-items: center;
}

/* The user profile image */
.coupons-profile-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid #ea6925;
}

/* The user label (e.g., "@username" or "Guest") */
.coupons-user-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

/* -------------- Header text for the coupon list -------------- */
.coupon-header {
    font-size: 16px;
    color: #ea6925;
    margin: 0 0 8px 0;
    font-weight: bold;
    text-align: center;
}

/* -------------- Coupon List + Items -------------- */
.coupon-list {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 8px 0;
    padding-right: 4px; /* helps avoid overlap with scrollbar */
}

/*
   "Coupon" item style:
   - dashed border to evoke real coupons
   - slight background tint
*/
.coupon-item {
    cursor:
        url('data:image/svg+xml;base64,PHN2Zw0KICAgICAgICB3aWR0aD0iNjAiDQogICAgICAgIGhlaWdodD0iMTYiDQogICAgICAgIHZpZXdCb3g9IjAgMCA2MCAxNiINCiAgICAgICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIg0KPg0KICAgIDwhLS0gT3ZlcmxhcHBpbmcgc3F1YXJlcyAocmVwcmVzZW50IHRoZSAiY29weSIgaWNvbikgLS0+DQogICAgPHJlY3QNCiAgICAgICAgICAgIHg9IjAiDQogICAgICAgICAgICB5PSIzIg0KICAgICAgICAgICAgd2lkdGg9IjgiDQogICAgICAgICAgICBoZWlnaHQ9IjEwIg0KICAgICAgICAgICAgZmlsbD0ibm9uZSINCiAgICAgICAgICAgIHN0cm9rZT0iI2VhNjkyNSINCiAgICAgICAgICAgIHN0cm9rZS13aWR0aD0iMSINCiAgICAgICAgICAgIHN0cm9rZS1saW5lY2FwPSJyb3VuZCINCiAgICAgICAgICAgIHN0cm9rZS1saW5lam9pbj0icm91bmQiDQogICAgLz4NCiAgICA8cmVjdA0KICAgICAgICAgICAgeD0iMiINCiAgICAgICAgICAgIHk9IjEiDQogICAgICAgICAgICB3aWR0aD0iOCINCiAgICAgICAgICAgIGhlaWdodD0iMTAiDQogICAgICAgICAgICBmaWxsPSJub25lIg0KICAgICAgICAgICAgc3Ryb2tlPSIjZWE2OTI1Ig0KICAgICAgICAgICAgc3Ryb2tlLXdpZHRoPSIxIg0KICAgICAgICAgICAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIg0KICAgICAgICAgICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCINCiAgICAvPg0KDQogICAgPCEtLSBUaGUgd29yZCAiQ29weSIgdG8gdGhlIHJpZ2h0IC0tPg0KICAgIDx0ZXh0DQogICAgICAgICAgICB4PSIxOCINCiAgICAgICAgICAgIHk9IjEyIg0KICAgICAgICAgICAgZmlsbD0iI2VhNjkyNSINCiAgICAgICAgICAgIGZvbnQtc2l6ZT0iMTAiDQogICAgICAgICAgICBmb250LWZhbWlseT0ic2Fucy1zZXJpZiINCiAgICA+DQogICAgICAgIENvcHkNCiAgICA8L3RleHQ+DQo8L3N2Zz4NCg==')
            8 8,
        copy;
    border: 2px dashed #ea6925;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
    background-color: #fff;
    position: relative;
}

/* Subtle hover effect */
.coupon-item:hover {
    background-color: #fff8f5;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.07);
}

/* Optional "ticket notch" effect (using :before/:after) */
.coupon-item:before,
.coupon-item:after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid #ea6925;
    border-radius: 50%;
}

.coupon-item:before {
    top: -9px;
    left: -9px;
}
.coupon-item:after {
    bottom: -9px;
    right: -9px;
}

/* The coupon's title */
.coupon-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

/* The coupon's description text */
.coupon-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

/* A container for the copy button */
.coupon-action {
    display: flex;
    align-items: center;
    margin-top: 5px;
    justify-content: flex-end;
}

/* -------------- The big, obvious Copy button -------------- */
.copyBtn {
    background: #ea6925;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition:
        background 0.3s ease,
        transform 0.1s;
}

.copyBtn:hover {
    background: #cf581f;
}

.copyBtn:active {
    transform: scale(0.97);
}

/* -------------- Logout / Login Button -------------- */
.coupons-logout-button {
    background: #fff;
    color: #ea6925;
    border: 2px solid #ea6925;
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.coupons-logout-button:hover {
    background: #ea6925;
    color: #fff;
}

/* -------------- Toast / Confirmation -------------- */
.copy-toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.copy-toast {
    background-color: #333;
    color: #fff;
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    opacity: 0.95;
    animation: fadeIn 0.3s ease forwards;
    font-size: 14px;
}

/* Fade out after the setTimeout triggers 'fade-out' class */
.copy-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

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

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

/* -------------- Media Queries (for small screens) -------------- */
/* only apply when viewport ≤480px AND on a touch device (no hover) */
@media only screen and (max-width: 480px) and (hover: none) and (pointer: coarse) {
    body,
    .popup-bg,
    .popup-wave {
        width: 100%;
        max-width: none;
    }

    .popup-container {
        width: 90%;
        max-width: none;
    }
}

.no-coupons-view {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.no-coupons-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

.no-coupons-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.supported-sites-btn,
.toggle-login-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

.supported-sites-btn {
    background: #ea6925;
    color: #fff;
    border: none;
}
.supported-sites-btn:hover {
    background: #cf581f;
}

.toggle-login-btn {
    background: #fff;
    color: #ea6925;
    border: 2px solid #ea6925;
}
.toggle-login-btn:hover {
    background: #ea6925;
    color: #fff;
}

.back-btn {
    background: none;
    border: none;
    color: #ea6925;
    font-size: 14px;
    cursor: pointer;
    margin-top: 16px;
}

.github-icon {
    width: 28px;
    height: 28px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.github-icon:hover {
    opacity: 1;
}
/* --- Unsupported-site section ----------------------------------- */

.no-coupons-view {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.no-coupons-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

.no-coupons-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.supported-sites-btn,
.toggle-login-btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.3s ease,
        color 0.3s ease;
}

.supported-sites-btn {
    background: #ea6925;
    color: #fff;
    border: none;
}
.supported-sites-btn:hover {
    background: #cf581f;
}

.toggle-login-btn {
    background: #fff;
    color: #ea6925;
    border: 2px solid #ea6925;
}
.toggle-login-btn:hover {
    background: #ea6925;
    color: #fff;
}

.back-btn {
    background: none;
    border: none;
    color: #ea6925;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 12px;
}

.github-icon {
    width: 28px;
    height: 28px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.github-icon:hover {
    opacity: 1;
}

@media (max-width: 480px) {
    .no-coupons-view {
        width: 90%;
        padding: 12px;
    }
    .coupons-profile-card {
        width: 90%;
        padding: 12px;
    }

    .coupon-item {
        padding: 8px;
        margin-bottom: 8px;
    }

    .coupon-title {
        font-size: 15px;
    }

    .copyBtn {
        width: 100%;
        justify-content: center;
        padding: 12px;
        font-size: 15px;
    }

    .coupons-logout-button {
        padding: 6px 12px;
        font-size: 14px;
    }
}
