:root {
    --primary: #2d5a27; /* Deep Forest Green */
    --secondary: #f4f1ea; /* Parchment/Paper White */
    --accent: #d4af37; /* Heritage Gold */
    --text: #333;
    --warn: #a94442;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--secondary);
    color: var(--text);
    line-height: 1.6;
    overflow-wrap: break-word;
    padding-top: 74px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
}

.logo { font-size: 1.2rem; font-weight: bold; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; }
.logo span { color: var(--accent); font-style: italic; }

ul { list-style: none; display: flex; gap: 20px; }
a { text-decoration: none; color: var(--text); }

.hero { text-align: center; padding: 60px 10%; background: #fff; }
.hero-desc { max-width: 800px; margin: 0 auto 40px; font-size: 1.1rem; color: #555; }
.how-it-works { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; margin-top: 40px; }
.step { flex: 1; min-width: 200px; max-width: 300px; padding: 20px; background: var(--secondary); border-radius: 8px; }
.step h3 { color: var(--primary); margin-bottom: 10px; }

/* Section Headers */
.section-header { text-align: center; padding: 40px 10% 20px; }
.section-header h2 { font-size: 2rem; color: var(--primary); margin-bottom: 10px; }
.premium-header { margin-top: 40px; border-top: 1px solid #ddd; padding-top: 60px; }

/* Software List Layout */
#software { position: relative; }
.software-list {
    padding: 20px 10% 50px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.software-item {
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    align-items: stretch;
}

.software-info {
    width: 100%;
    position: relative;
}

.software-gallery {
    width: 100%;
    position: relative;
    aspect-ratio: 16/8;
    max-width: 980px;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.gallery-img {
    background: #f8f9fa;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #666;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: zoom-in;
    position: relative;
    z-index: 1;
}

.gallery-img:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.16);
    border-color: var(--primary);
}

.gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
}

.gallery-control.prev {
    left: 12px;
}

.gallery-control.next {
    right: 12px;
}

.premium-item { border: 2px solid var(--accent); }
.badge { 
    display: inline-block; 
    background: var(--accent); 
    color: var(--text); 
    padding: 2px 10px; 
    font-size: 0.8rem; 
    border-radius: 5px; 
    margin-bottom: 10px;
}
.action-area { margin-top: 20px; }

.btn-primary { background: var(--primary); color: white; padding: 10px 20px; border-radius: 5px; display: inline-block; }
.btn-secondary { background: #6c757d; color: white; padding: 10px 20px; border-radius: 5px; display: inline-block; transition: background 0.3s; }
.btn-secondary:hover { background: #5a6268; }
.btn-portal { border: 1px solid var(--primary); padding: 5px 15px; border-radius: 5px; }

.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 0 10% 50px; }
form { display: flex; flex-direction: column; gap: 10px; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
textarea { height: 100px; padding: 10px; }
.btn-warn { background: var(--warn); color: white; border: none; padding: 10px; cursor: pointer; }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white; padding: 40px; border-radius: 8px; width: 380px; max-width: 92vw;
    display: flex; flex-direction: column; gap: 15px;
}
.modal-content input { padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
.verify-email-address { font-size: 0.72rem; white-space: nowrap; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    min-width: 200px;
    font-size: 0.9rem;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: var(--warn);
}

.toast.success {
    background: var(--primary);
}

/* Image Lightbox */
.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 24px;
}

.image-lightbox.open {
    display: flex;
}

.lightbox-image {
    max-width: min(1400px, 95vw);
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
    object-fit: contain;
    background: #111;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 20px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
}

/* Loading Spinner State for Buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none; /* Prevent double clicks */
}
.btn-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Coming Soon State */
.coming-soon {
    position: relative;
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
    border-color: #bbb !important;
    pointer-events: auto; /* Ensure hover works */
}
.coming-soon:hover::after {
    content: "Coming Soon";
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Portal Specifics */
.portal-container {
    padding: 40px 10%;
    min-height: 60vh;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.portal-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.premium-card {
    border: 2px solid var(--accent);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.version-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
}

.resource-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.resource-list li {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.resource-list a {
    color: var(--primary);
    font-weight: 500;
}
.resource-list a:hover {
    text-decoration: underline;
}

.owner-support-panel {
    margin-top: 30px;
}

.support-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 20px;
}

.support-list-wrap,
.support-thread-wrap {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.support-ticket-list,
.support-reply-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    max-height: 380px;
    overflow: auto;
}

.support-ticket-item {
    text-align: left;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fdfdfd;
    cursor: pointer;
}

.support-ticket-item:hover {
    border-color: var(--primary);
    background: #f7fbf7;
}

.support-reply-item {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fafafa;
}

/* Free Tier Overlay */
.overlay-clipper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
}

.coming-soon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 15vw;
    color: rgba(255, 0, 0, 0.15);
    -webkit-text-stroke: 3px rgba(255, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    user-select: none;
}

/* Accessibility: Focus Indicators */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    ul {
        flex-wrap: wrap;
        justify-content: center;
        padding: 0;
        gap: 15px;
    }

    .hero {
        padding: 40px 5%;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .software-list {
        padding: 20px 5% 40px;
    }

    .software-item {
        padding: 20px;
        flex-direction: column;
        gap: 20px;
    }

    .software-info,
    .software-gallery {
        min-width: 0;
    }

    .feedback-grid {
        grid-template-columns: 1fr;
        padding: 0 5% 40px;
    }

    .portal-container {
        padding: 20px 5%;
    }

    .support-layout {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 85%;
        padding: 25px;
    }

    /* Reduce hover effect on touch devices to prevent layout issues */
    .gallery-img:hover {
        transform: none;
    }
}
