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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 1rem;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Main Screen - Just the shiny button */
#mainScreen {
    justify-content: center;
    align-items: center;
    background: white;
}

.glossy-main-button {
    display: inline-block;
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, 
        #ffffff 0%, 
        #f5f5f5 30%, 
        #e8e8e8 50%, 
        #d9d9d9 70%,
        #c8c8c8 100%);
    border: 1px solid #b8b8b8;
    border-radius: 50%;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.15),
        inset 0 3px 10px rgba(255, 255, 255, 0.8),
        inset 0 -3px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.glossy-main-button::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 40%;
    background: radial-gradient(ellipse at center, 
        rgba(255, 255, 255, 0.6) 0%, 
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    pointer-events: none;
}

.glossy-main-button:hover {
    background: linear-gradient(to bottom, 
        #fafafa 0%, 
        #efefef 50%, 
        #e0e0e0 51%, 
        #d0d0d0 100%);
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.glossy-main-button:active {
    background: linear-gradient(to bottom, 
        #c8c8c8 0%, 
        #d5d5d5 50%, 
        #e0e0e0 51%, 
        #e8e8e8 100%);
    box-shadow: 
        inset 0 3px 8px rgba(0, 0, 0, 0.25),
        inset 0 1px 3px rgba(0, 0, 0, 0.15);
    transform: translateY(2px);
}

/* Intent Screen */
#intentScreen {
    background: white;
}

.thumbnail {
    width: 100%;
    margin-bottom: 1.5rem;
}

.thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.intent-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.intent-button {
    width: 100%;
    padding: 15px 40px;
    background: linear-gradient(to bottom, 
        #ffffff 0%, 
        #f5f5f5 50%, 
        #e8e8e8 51%, 
        #d9d9d9 100%);
    border: 1px solid #b8b8b8;
    border-radius: 25px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    color: #000;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-transform: capitalize;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.intent-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.5) 0%, 
        rgba(255, 255, 255, 0) 100%);
    border-radius: 25px 25px 0 0;
    pointer-events: none;
}

.intent-button:hover {
    background: linear-gradient(to bottom, 
        #fafafa 0%, 
        #efefef 50%, 
        #e0e0e0 51%, 
        #d0d0d0 100%);
    box-shadow: 
        0 5px 10px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.intent-button:active {
    background: linear-gradient(to bottom, 
        #c8c8c8 0%, 
        #d5d5d5 50%, 
        #e0e0e0 51%, 
        #e8e8e8 100%);
    box-shadow: 
        inset 0 3px 8px rgba(0, 0, 0, 0.25),
        inset 0 1px 3px rgba(0, 0, 0, 0.15);
    transform: translateY(2px);
}

.no-intents {
    text-align: center;
    color: #999;
    font-size: 1rem;
    padding: 2rem;
}

/* Result Screen */
#resultScreen {
    background: white;
    overflow-y: auto;
}

/* Icon Toolbar */
.icon-toolbar {
    display: flex;
    justify-content: space-evenly;
    margin-bottom: 1.5rem;
    padding: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.icon-button:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.icon-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    line-height: 1.6;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.waiting-message {
    display: none;
    margin-top: 20px;
    color: white;
    font-size: 16px;
    text-align: center;
    max-width: 80%;
    padding: 0 20px;
    animation: fadeIn 0.5s ease-in;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Content Block Styling (from response_renderer) */
.content-block {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: 12px;
    background: #f8f9fa;
}

.content-block h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

/* Collapsible sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 30px;
}

.collapsible-header::after {
    content: '\25BC';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.collapsible-header.expanded::after {
    transform: translateY(-50%) rotate(180deg);
}

.collapsible-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.content-block h3 {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    color: #34495e;
    font-size: 1.1rem;
}

.content-block p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

.content-block ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.content-block ul li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

/* Products Section */
.products-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 2px solid #e0e0e0;
}

.products-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.products-list {
    list-style: none;
    padding: 0;
}

.product-item {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-item strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.product-item p {
    margin: 0.5rem 0;
    color: #555;
    font-size: 0.9rem;
}

.product-item a {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.product-item a:hover {
    background: #5568d3;
}

/* Tablet and larger */
@media (min-width: 768px) {
    #shinyButton {
        max-width: 500px;
    }
    
    .screen {
        padding: 2rem;
    }
    
    .intent-buttons {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }
    
    .thumbnail {
        max-width: 600px;
        margin: 0 auto 1.5rem;
    }
}

/* Result Image Thumbnail */
.result-image-thumbnail {
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-image-thumbnail img {
    max-height: 200px;
    max-width: 100%;
    width: auto !important;
    height: auto !important;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    object-fit: contain;
}

/* Feedback Section - Mobile First */
.feedback-section {
    margin: 2rem 0 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feedback-section h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    color: #2c3e50;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}

/* Emoji Rating - Mobile First Design */
.emoji-rating {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.emoji-rating input[type="radio"] {
    display: none;
}

.emoji-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
}

.emoji-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.emoji-face {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease;
}

.emoji-option:hover .emoji-face {
    transform: scale(1.1);
}

.emoji-label {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
    font-weight: 500;
}

.emoji-rating input[type="radio"]:checked + .emoji-option {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.emoji-rating input[type="radio"]:checked + .emoji-option .emoji-face {
    transform: scale(1.15);
}

.emoji-rating input[type="radio"]:checked + .emoji-option .emoji-label {
    color: #667eea;
    font-weight: 600;
}

/* Feedback Textarea */
#feedbackText {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#feedbackText:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Submit Button */
.feedback-submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.feedback-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.feedback-submit-btn:active {
    transform: translateY(0);
}

.feedback-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Feedback Messages */
.feedback-success,
.feedback-error {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.feedback-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Tablet and larger adjustments */
@media (min-width: 768px) {
    .emoji-option {
        padding: 1.25rem 1rem;
    }

    .emoji-face {
        font-size: 3rem;
    }

    .emoji-label {
        font-size: 0.85rem;
    }
}

/* Share Dialog Styles */
.share-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.share-dialog-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

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

.share-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.share-dialog-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.share-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.share-close-btn:hover {
    color: #333;
}

.share-dialog-body {
    padding: 1.5rem;
}

.share-link-section {
    margin-bottom: 1.5rem;
}

.share-link-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.share-link-input {
    display: flex;
    gap: 0.5rem;
}

.share-url-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #666;
    background: #f9f9f9;
}

.copy-link-btn {
    padding: 0.75rem 1rem;
    background: #0a84ff;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.copy-link-btn:hover {
    background: #0870e8;
}

.copy-link-btn:active {
    background: #0a6fd9;
}

.share-methods {
    margin-bottom: 1.5rem;
}

.share-methods > p {
    margin-bottom: 1rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.share-method-btn {
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.share-method-btn:hover {
    background: #e8e8e8;
    border-color: #999;
}

.share-method-btn:active {
    transform: scale(0.98);
}

.share-method-btn.facebook {
    background: #f0f2f5;
    border-color: #e4e6eb;
    color: #1877f2;
}

.share-method-btn.facebook:hover {
    background: #e4e6eb;
    border-color: #ccc;
    color: #0a66c2;
}

.share-method-btn span {
    font-size: 1.2rem;
}

.share-error {
    padding: 0.75rem 1rem;
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.share-success {
    padding: 0.75rem 1rem;
    background: #efe;
    color: #060;
    border: 1px solid #cfc;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.share-qrcode-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.share-qrcode-container canvas {
    border-radius: 4px;
    background: white;
    padding: 8px;
}

/* Mobile responsiveness for share dialog */
@media (max-width: 480px) {
    .share-dialog-content {
        width: 95%;
        max-height: 95vh;
    }

    .share-dialog-header {
        padding: 1.25rem 1rem;
    }

    .share-dialog-body {
        padding: 1.25rem 1rem;
    }

    .share-link-input {
        flex-direction: column;
    }

    .copy-link-btn {
        width: 100%;
    }
}

/* Library Styles */
.library-float-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: transform 0.2s;
}

.library-float-btn:hover {
    transform: scale(1.1);
}

.library-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav-back-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: #0a84ff;
    cursor: pointer;
    padding: 0.5rem 1rem 0.5rem 0;
    font-weight: 600;
}

.library-header h2 {
    flex: 1;
    text-align: center;
    font-size: 1.2rem;
    margin-right: 2rem; /* Balance back button */
}

.library-tabs {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    background: white;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #0a84ff;
    color: white;
}

.library-content {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    padding-bottom: 4rem;
}

.library-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.library-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.library-item-thumb {
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    position: relative;
    background: #eee;
}

.library-item-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-item-info {
    padding: 0.75rem;
}

.library-item-date {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.25rem;
}

.library-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.save-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 0.8rem;
}

.icon-button.active {
    background: #e6f2ff;
    border: 2px solid #0a84ff;
}

/* Custom Intent Input */
.custom-intent-container {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.custom-intent-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.custom-intent-input:focus {
    outline: none;
    border-color: #b8b8b8;
}

.custom-intent-submit {
    padding: 12px 16px;
    margin: 0;
    flex-shrink: 0;
}

/* Result Context Section */
.result-context {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.result-intent {
    margin: 0;
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
}

.image-description-section {
    margin-top: 1rem;
}

.result-context:first-of-type .image-description-section {
    margin-top: 0;
}

.description-label {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.description-preview {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.description-expand-btn,
.description-collapse-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.description-expand-btn:hover,
.description-collapse-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.description-full {
    margin-top: 0.5rem;
}

.description-full p {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}
