/* ========== CSS Variables ========== */
:root {
    --color-primary: #193c76;
    --color-primary-light: #2a5494;
    --color-accent: #2b9f6f;
    --color-accent-light: #3bb983;
    --color-yellow: #edd25f;
    --color-bg: #ffffff;
    --color-fg: #1a1a2e;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-card: #ffffff;

    --shadow-popup: 0 20px 60px -10px rgba(25, 60, 118, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --gradient-primary: linear-gradient(135deg, #193c76, #2a5494);
    --gradient-accent: linear-gradient(135deg, #2b9f6f, #3bb983);
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    color: var(--color-fg);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== Container ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1rem;
}

.content-wrapper {
    max-width: 1000px;
    margin: 0 auto;
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--color-muted);
    max-width: 700px;
    margin: 0 auto;
}

/* ========== Button Grid ========== */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.demo-card {
    position: relative;
    background: var(--color-card);
    border: 2px solid var(--color-border);
    border-radius: 1rem;
    padding: 2rem;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    text-align: center;
}

.demo-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-popup);
}

.demo-card:active {
    transform: scale(0.98);
}

.card-gradient {
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.accent-gradient {
    background: var(--gradient-accent);
}

.login-gradient {
    background: linear-gradient(135deg, rgba(237, 210, 95, 0.1), rgba(25, 60, 118, 0.1));
}

.demo-card:hover .card-gradient {
    opacity: 0.1;
}

.card-content {
    position: relative;
    z-index: 1;
}

.card-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: rgba(25, 60, 118, 0.1);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: var(--transition);
}

.accent-icon {
    background: rgba(43, 159, 111, 0.1);
    color: var(--color-accent);
}

.login-icon {
    background: rgba(237, 210, 95, 0.1);
    color: var(--color-yellow);
}

.demo-card:hover .card-icon {
    transform: scale(1.1);
}

.card-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-fg);
}

.card-desc {
    color: var(--color-muted);
    margin-bottom: 1rem;
}

.card-cta {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(25, 60, 118, 0.1);
    color: var(--color-primary);
    font-weight: 600;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.accent-cta {
    background: rgba(43, 159, 111, 0.1);
    color: var(--color-accent);
}

.login-cta {
    background: rgba(237, 210, 95, 0.1);
    color: var(--color-yellow);
}

.demo-card:hover .card-cta {
    background: var(--color-primary);
    color: white;
}

.demo-card:hover .accent-cta {
    background: var(--color-accent);
    color: white;
}

.demo-card:hover .login-cta {
    background: var(--color-yellow);
    color: white;
}

/* ========== Features Grid ========== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 4rem;
}

.feature-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: rgba(25, 60, 118, 0.3);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.feature-card h4 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* ========== Popup Overlay ========== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.popup-overlay.active {
    display: flex;
}

.popup-container {
    position: relative;
    background: var(--color-bg);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-popup);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease-out;
}

.login-container {
    max-width: 400px;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.close-btn:hover {
    background: var(--color-border);
    transform: scale(1.1) rotate(90deg);
}

.popup-content {
    padding: 2rem;
}

/* ========== Product Popup ========== */
.product-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .product-content {
        grid-template-columns: 1fr 1fr;
    }
}

.product-gallery {
    display: flex;
    flex-direction: column;
}

.main-image {
    position: relative;
    aspect-ratio: 1;
    height: auto;
    width: 100%;
    max-height: 400px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 4px solid rgba(25, 60, 118, 0.2);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.main-image:hover img {
    transform: scale(1.1);
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    max-width: 100%;
}

.thumbnail {
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    background: none;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(25, 60, 118, 0.3);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-details h2 {
    font-size: 1.5rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.product-features {
    margin-bottom: 1.5rem;
    color: var(--color-muted);
}

.product-features p {
    margin-bottom: 0.5rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.add-to-cart-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(25, 60, 118, 0.3);
}

.add-to-cart-btn:active {
    transform: scale(0.98);
}

/* ========== Image Popup ========== */
.image-title {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.image-wrapper {
    border-radius: 0.75rem;
    overflow: hidden;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.image-wrapper:hover img {
    transform: scale(1.05);
}

/* ========== Login Popup ========== */
.login-content {
    position: relative;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.login-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    opacity: 0.05;
    pointer-events: none;
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-hint {
    font-size: 0.875rem;
    color: var(--color-muted);
}

.register-link {
    color: var(--color-yellow);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.register-link:hover {
    text-decoration: underline;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(25, 60, 118, 0.1);
}

.form-input:disabled {
    background: rgba(0, 0, 0, 0.03);
    cursor: not-allowed;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

.edit-icon,
.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.edit-icon:hover,
.toggle-password:hover {
    color: var(--color-primary);
}

/* Buttons */
.btn-next {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(180deg, #e9eef7, #dee7f3);
    color: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
}

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

.btn-next:not(:disabled):hover {
    background: linear-gradient(180deg, #dee7f3, #d5dfe9);
}

.btn-login {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.forgot-password {
    text-align: right;
    margin-bottom: 1rem;
}

.forgot-password a {
    color: var(--color-yellow);
    text-decoration: none;
    font-size: 0.875rem;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.separator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--color-muted);
    font-size: 0.875rem;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.separator span {
    transition: var(--transition);
}

.separator:hover span {
    color: var(--color-primary);
}

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.google-btn:hover {
    background: rgba(0, 0, 0, 0.02);
}

.google-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 0.375rem;
}

.google-icon img {
    width: 1.25rem;
    height: 1.25rem;
}

.google-text span {
    transition: color 0.3s ease;
}

.google-btn:hover .google-text span:nth-child(1) {
    color: #4285f4;
}

.google-btn:hover .google-text span:nth-child(2) {
    color: #ea4335;
}

.google-btn:hover .google-text span:nth-child(3) {
    color: #fbbc05;
}

.google-btn:hover .google-text span:nth-child(4) {
    color: #4285f4;
}

.google-btn:hover .google-text span:nth-child(5) {
    color: #34a853;
}

.google-btn:hover .google-text span:nth-child(6) {
    color: #ea4335;
}

.card-decor {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -1.75rem;
    width: 16rem;
    height: 2.5rem;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.01));
    filter: blur(12px);
    border-radius: 50%;
    z-index: -1;
}

/* ========== Skeleton Loaders ========== */
.skeleton-loader {
    animation: fadeIn 0.3s ease-out;
}

.skeleton-main,
.skeleton-thumb,
.skeleton-image,
.skeleton-line,
.skeleton-input {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 0.75rem;
}

/* Product Skeleton */
.skeleton-main {
    aspect-ratio: 1;
    margin-bottom: 1rem;
}

.skeleton-thumbnails {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.skeleton-thumb {
    aspect-ratio: 1;
}

/* Image Skeleton */
.skeleton-image {
    width: 100%;
    height: 70vh;
}

/* Login Skeleton */
.skeleton-line {
    height: 2rem;
    margin-bottom: 0.5rem;
}

.skeleton-line.short {
    width: 75%;
    height: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-input {
    height: 3rem;
    margin-bottom: 1rem;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive ========== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .popup-container {
        max-width: 95%;
    }
    
    .main-image {
        max-height: 350px;
    }
}

/* Mobile Landscape & Small Tablet (600px - 768px) */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .button-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .popup-overlay {
        padding: 0.5rem;
    }

    .popup-container {
        border-radius: 1rem;
        max-height: 95vh;
    }

    .popup-content {
        padding: 1.5rem;
    }

    .close-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 2rem;
        height: 2rem;
    }

    .close-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Product Popup Mobile */
    .product-content {
        gap: 1.5rem;
    }

    .main-image {
        max-height: 300px;
        border-width: 2px;
    }

    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 0.375rem;
    }

    .product-details h2 {
        font-size: 1.25rem;
    }

    /* Login Popup Mobile */
    .login-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .login-header h2 {
        font-size: 1.125rem;
    }

    .register-link {
        margin-left: 0;
    }

    .form-input {
        font-size: 0.9375rem;
        padding: 0.75rem 0.875rem;
    }
}

/* Mobile Portrait (480px - 600px) */
@media (max-width: 600px) {
    .container {
        padding: 2rem 0.75rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .demo-card {
        padding: 1.5rem;
    }

    .card-icon {
        width: 3rem;
        height: 3rem;
    }

    .popup-overlay {
        padding: 0.25rem;
        align-items: flex-start;
        padding-top: 1rem;
    }

    .popup-container {
        margin: auto 0;
    }

    .popup-content {
        padding: 1.25rem;
    }

    .close-btn {
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Product Popup Small Mobile */
    .main-image {
        max-height: 250px;
    }

    .main-image:hover img {
        transform: none; /* Disable zoom on mobile */
    }

    .thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }

    .thumbnail:hover {
        transform: none;
    }

    .product-details h2 {
        font-size: 1.125rem;
    }

    .product-features {
        font-size: 0.875rem;
    }

    .add-to-cart-btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }

    /* Image Popup Small Mobile */
    .image-title {
        font-size: 1.25rem;
    }

    .image-wrapper img {
        max-height: 60vh;
    }

    .image-wrapper:hover img {
        transform: none;
    }

    /* Login Small Mobile */
    .login-container {
        max-width: 100%;
    }

    .btn-next,
    .btn-login {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .google-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.9375rem;
    }

    .google-icon {
        width: 1.75rem;
        height: 1.75rem;
    }

    .separator {
        margin: 1.25rem 0;
        font-size: 0.8125rem;
    }
}

/* Extra Small Mobile (320px - 480px) */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9375rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .popup-container {
        border-radius: 0.75rem;
    }

    .popup-content {
        padding: 1rem;
    }

    /* Product Popup Extra Small */
    .main-image {
        max-height: 220px;
        border-radius: 0.5rem;
    }

    .thumbnails {
        grid-template-columns: repeat(3, 1fr);
        margin-top: 0.75rem;
    }

    .thumbnail {
        border-radius: 0.375rem;
    }

    .skeleton-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Login Extra Small */
    .login-header h2 {
        font-size: 1rem;
    }

    .login-hint {
        font-size: 0.8125rem;
    }

    .form-input {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }

    .input-hint {
        font-size: 0.6875rem;
    }

    .card-decor {
        width: 12rem;
        height: 2rem;
    }
}

/* Very Small Mobile (< 360px) */
@media (max-width: 360px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .popup-overlay {
        padding: 0;
    }

    .popup-container {
        border-radius: 0;
        max-height: 100vh;
    }

    .close-btn {
        width: 1.75rem;
        height: 1.75rem;
    }

    .main-image {
        max-height: 200px;
    }

    .thumbnails {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }

    .product-details h2 {
        font-size: 1rem;
    }

    .login-container {
        border-radius: 0;
    }
}

/* Landscape Orientation on Mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .popup-overlay {
        align-items: flex-start;
        padding: 0.5rem;
    }

    .popup-container {
        margin: 0 auto;
        max-height: 95vh;
    }

    .popup-content {
        padding: 1rem;
    }

    .main-image {
        max-height: 200px;
    }

    .product-content {
        gap: 1rem;
    }

    .skeleton-main {
        max-height: 200px;
    }
}