/* Base Styles */
/* Fallback values only — this file is served as a static .css file, so
   PHP never runs inside it. The real, per-app colors (derived from each
   app icon's dominant color) are injected as an inline <style> override
   in the <head> of app.php, right after this stylesheet is linked. These
   are just safe defaults in case that inline block is ever missing. */
:root {
    --primary-color: #00c35e;
    --secondary-color: #1fa702;
    --accent-color: #36db85;
    --light-color: #eef2ff;
    --dark-color: #0f1c14;
    --success-color: #10b981;
    --danger-color: #f72585;
    --games-color: #073d13;
    --apps-color: #33d17a;
    --rating-color: #1fa702;
    --button-text-color: #ffffff;
    --icon-color: #ffffff;
}

/* Breadcrumb pill is a shared component (breadcrumb-pill.css) used on
   several pages with a fixed gradient. On the app/game detail page only,
   override it to follow this app's dynamic theme color instead. */
.breadcrumb-pill {
    background: var(--secondary-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #EFF7F1;
    color: var(--dark-color);
    line-height: 1.6;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout Styles */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Breadcrumbs: see breadcrumb-pill.css for the shared pill component */

/* App Overview Section */
.app-overview {
    background-color: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
}

.app-title {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 0;
    color: #374151;
}

.app-content {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
}

.app-image-container {
    width: 25%;
    padding-right: 32px;
    margin-bottom: 0;
    text-align: left;
}

.app-details {
    width: 57.333333%;
    padding-right: 32px;
    margin-bottom: 24px;
}

.app-image {
    width: 160px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* App Details Table */
.details-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.detail-row {
    display: table-row;
}

.detail-label, .detail-value {
    display: table-cell;
    padding-bottom: 8px;
    font-size: 16px;
    color: #374151;
}

.detail-label {
    padding-right: 30px;
    vertical-align: top;
    font-weight: 600;
    width: 40%;
}

.detail-value {
    padding-left: 15px;
}

.detail-icon {
    width: 20px;
    margin-right: 8px;
    color: var(--secondary-color);
}

.category-link {
    color: var(--secondary-color);
    text-decoration: none;
}

.premium-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Rating Widget */
.rating-widget {
    width: 17.666667%;
    text-align: center;
    margin-bottom: 24px;
}

.rating-stars {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.star {
    font-size: 1.4rem;
    color: #ccc;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.star.filled {
    color: var(--rating-color);
}

.star.hover {
    color: var(--rating-color);
    transform: scale(1.2);
}

.rating-button {
    background-color: var(--secondary-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background-color 0.3s;
}

.rating-button:hover {
    background-color: var(--primary-color);
}

.rating-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.rating-feedback {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    min-height: 20px;
    display: none;
}

.rating-results {
    font-size: 15px;
    color: #4a5568;
}

/* Download Buttons */
.download-buttons {
    margin: 16px 0;
}

.download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    color: var(--button-text-color);
    text-decoration: none;
    border-radius: 50px;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.download-button:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

.download-icon {
    width: 20px;
    height: 20px;
    margin-right: 16px;
    color: var(--icon-color);
}

/* App Description Section */
.app-description-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: 40px 0;
    overflow: hidden;
}

.app-description-content {
    padding: 30px;
}

.app-description-card img {
    width: 100%;
}

.app-description-content h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: var(--dark-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.app-description-content p {
    line-height: 1.8;
    color: #495057;
    margin-bottom: 1.2em;
}

/* Related Apps Section */
.related-apps-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: 40px 0;
    overflow: hidden;
}

.section-header {
    padding: 20px 30px;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    background-image: linear-gradient(to bottom right, var(--gradient-from), var(--gradient-to));
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
}

.section-icon svg {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    overflow: visible;
}

.related-apps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding: 0 30px 30px;
}

.related-app-card {
    background-color: white;
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 297px;
    box-shadow: rgba(17, 17, 26, 0.05) 0px 4px 16px, rgba(17, 17, 26, 0.05) 0px 8px 32px;
}

.related-app-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.related-app-card-img {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

.related-app-card-img img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.related-app-card-title {
    font-size: .875rem;
    margin-top: -.25rem;
    margin-bottom: .25rem;
    text-align: center;
}

.related-app-card-meta {
    display: flex;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.related-app-card-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 15px;
    position: relative;
    margin-top: auto;
}

.related-app-card-details::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 100%;
    width: 1px;
    background-color: #e0e0e0;
}

.related-app-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 50%;
}

.related-app-detail svg {
    width: 16px;
    height: 16px;
}

/* Badges */
.game-badge, .app-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
}

.game-badge {
    background-color: var(--games-color);
}

.app-badge {
    background-color: var(--apps-color);
}

/* Comment Section */
.comment-form-card, .comments-list-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: 40px 0;
    overflow: hidden;
}

.comment-form-content, .comments-list-content {
    padding: 0 30px 30px;
}

.form-wrapper {
    width: 100%;
}

.form-group {
    padding: 0.75rem;
    margin: -0.75rem;
    display: flex;
    flex-wrap: wrap;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.8rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    outline: none;
}

.form-input:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--secondary-color);
}

.textarea {
    min-height: 10rem;
    resize: vertical;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
    width: calc(100% + 1.5rem);
}

.form-col {
    width: 50%;
    padding: 0.75rem;
    position: relative;
}

.checkbox {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.checkbox input {
    margin-right: 0.5rem;
}

.btn {
    display: inline-block;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--button-text-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--secondary-color);
    margin-top: 0.75rem;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

/* Comment Styles */
.comment {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    position: relative;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.comment-date {
    color: #95a5a6;
    font-size: 14px;
}

.comment-content {
    line-height: 1.6;
}

.success-message {
    background-color: #d4edda;
    color: #22c55e;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

/* Get Link Button */
.get-link-container {
    max-width: 800px;
    margin: 20px auto;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
    display: none;
}

.get-link-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color) 50%, var(--secondary-color) 51%, var(--accent-color) 71%, var(--primary-color));
    color: white;
    background-size: 400% 400%;
    animation: AnimationName 3s ease infinite;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    margin: 1rem 0;
    box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
}

.security-note {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.security-note i {
    color: var(--success-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes AnimationName {
    0%,100% {background-position:0 31%}
    50% {background-position:100% 70%}
}

#app-description-end {
    position: relative;
    top: -50px;
    visibility: hidden;
}

/* Dark Mode Styles */
body.dark {
    background-color: #1a202c;
    color: #e2e8f0;
}

body.dark .app-overview,
body.dark .app-description-card,
body.dark .related-apps-card,
body.dark .related-app-card,
body.dark .comment-form-card,
body.dark .comments-list-card {
    background-color: #2d3748;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body.dark .app-title,
body.dark .detail-label,
body.dark .detail-value,
body.dark .app-description-content h3,
body.dark .rating-results,
body.dark .section-header h3,
body.dark .app-description-content p,
body.dark .related-app-card-title,
body.dark .related-app-card-meta,
body.dark .related-app-category,
body.dark .related-app-card-details,
body.dark .comment-author,
body.dark .comment-content,
body.dark .form-label,
body.dark .form-input {
    color: #f3f4f6;
}

body.dark .form-input {
    background-color: #4a5568;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark .form-input:focus {
    box-shadow: 0 0 0 2px var(--secondary-color);
}

body.dark .comment {
    background-color: #4a5568;
}

body.dark .comment-date {
    color: #a0aec0;
}

body.dark .checkbox label {
    color: #e2e8f0;
}

/* Mobile Styles - Only using @media (max-width: 
px) */
@media (max-width: 768px) {
    .app-overview, .app-description-content {
        padding: 15px;
    }
    
    .breadcrumb-pill {
        font-size: 0.72rem;
    }
    
    .app-title {
    font-size: 22px;
    }
    
    .app-content {
        flex-direction: column;
    }
    
    .app-image-container,
    .app-details,
    .rating-widget {
        width: 100%;
        padding-right: 0;
    }
    
    .app-image-container {
        margin-bottom: 32px;
        text-align: center;
    }
    
    .app-image {
        margin: 0 auto;
    }

    .rating-widget {
        margin-top: 20px;
    }
    
    .related-apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 20px;
    }
    
    .section-header h3 {
        font-size: 1.25rem;
    }
    
    .details-table {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .detail-row {
        display: flex;
        flex-direction: column;
        background-color: var(--light-color);
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .detail-label {
        display: flex;
        align-items: center;
        padding: 0;
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: bold;
        width: 100%;
    }
    
    .detail-value {
        display: block;
        padding: 0;
        font-size: 14px;
    }
    
    body.dark .detail-label,
    body.dark .detail-value {
        color: #000000;
    }
    
    .form-col {
        width: 100%;
    }
}
