/* Fruit Drawing App Styles */
.draw-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
}

/* Main Screen */
.main-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    opacity: 1;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
}

.main-screen.active {
    display: flex;
    opacity: 1;
}

.main-screen:not(.active) {
    display: none;
    opacity: 0;
}

/* Canvas View Mode */
.main-screen.canvas-view {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.main-screen.canvas-view .left-panel {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.main-screen:not(.canvas-view) .left-panel {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.main-screen.canvas-view .right-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    padding: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.main-screen.canvas-view .leaderboard-widget {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.main-screen.canvas-view .floating-drawings {
    z-index: 2;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.main-screen.canvas-view .floating-drawing {
    opacity: 0.9;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.main-screen.canvas-view .floating-drawing:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* Ensure floating drawings are visible in normal mode too */
.main-screen:not(.canvas-view) .floating-drawings {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Main content fade transition */
.main-screen .main-content {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.main-screen.canvas-view .main-content {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Canvas View Instructions */
.main-screen.canvas-view::before {
    content: "Click anywhere to go back";
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Rating Modal */
#rating-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.rating-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.rating-modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.rating-modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.rating-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.rating-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.rating-modal-body {
    padding: 30px;
    text-align: center;
}

.rating-drawing-preview {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}

.rating-drawing-preview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    background: none;
}

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

.rating-btn {
    background: none;
    border: 3px solid #e9ecef;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.rating-btn.thumbs-up:hover {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.rating-btn.thumbs-down:hover {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.rating-instruction {
    color: #666;
    font-size: 14px;
    margin: 0;
}

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

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

/* Floating Drawings Background */
.floating-drawings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.floating-drawing {
    position: absolute;
    width: 80px;
    height: 80px;
    animation: floatAround 20s infinite linear;
    opacity: 0.7;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.floating-drawing img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    outline: none;
}

@keyframes floatAround {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    25% {
        transform: translateX(100px) translateY(-50px) rotate(90deg);
    }
    50% {
        transform: translateX(200px) translateY(0) rotate(180deg);
    }
    75% {
        transform: translateX(100px) translateY(50px) rotate(270deg);
    }
    100% {
        transform: translateX(0) translateY(0) rotate(360deg);
    }
}

/* Main Content */
.main-content {
    display: flex;
    height: 100%;
    z-index: 2;
    position: relative;
}

.left-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.right-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

/* Welcome Message */
.welcome-message {
    margin-bottom: 40px;
}

.welcome-message h2 {
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    font-weight: bold;
}

.funny-message {
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 500px;
    margin: 0 auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 300px;
}

.action-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    border: none;
    border-radius: 50px;
    padding: 20px 30px;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    background: linear-gradient(45deg, #ff5252, #ff7979);
}

.action-btn:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-text {
    font-size: 1rem;
}

/* Leaderboard Widget */
.leaderboard-widget {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 300px;
}

.leaderboard-widget h3 {
    margin: 0 0 15px 0;
    color: #333;
    text-align: center;
    font-size: 1.2rem;
}

.leaderboard-mini {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    transition: transform 0.2s ease;
}

.mini-leaderboard-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.8);
}

.mini-rank {
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 30px;
}

.mini-preview {
    width: 40px;
    height: 40px;
    border-radius: 0;
    overflow: visible;
    background: none;
}

.mini-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
}

.mini-rating {
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
}

/* Drawing Mode */
.drawing-mode {
    display: none;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
}

.drawing-mode.active {
    display: flex;
}

.draw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.draw-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.post-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.post-btn:hover {
    background: #1e7e34;
    transform: translateY(-1px);
}

/* Drawing Toolbar */
.draw-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    align-items: flex-start;
}

.tool-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.tool-section h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-buttons, .color-palette, .brush-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tool-btn, .color-btn, .size-btn {
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    min-width: 36px;
    height: 36px;
}

.tool-btn:hover, .color-btn:hover, .size-btn:hover {
    background: #f8f9fa;
    border-color: #0078d7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-btn.active, .color-btn.active, .size-btn.active {
    background: #0078d7;
    border-color: #005a9e;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 120, 215, 0.3);
}

.color-btn {
    border-radius: 50%;
    min-width: 32px;
    height: 32px;
    padding: 4px;
}

.size-btn {
    font-size: 12px;
    font-weight: bold;
    color: #495057;
}

.size-btn.active {
    color: white;
}

.draw-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 100px;
}

.draw-btn {
    background: #0078d7;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-align: center;
}

.draw-btn:hover {
    background: #005a9e;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.draw-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.save-btn {
    background: #28a745;
}

.save-btn:hover {
    background: #1e7e34;
}

.load-btn {
    background: #6c757d;
}

.load-btn:hover {
    background: #5a6268;
}

/* Canvas Container */
.draw-canvas-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #dee2e6;
    margin: 0 15px 15px 15px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

#draw-canvas {
    display: block;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    cursor: crosshair;
    touch-action: none;
    /* Checkered background to show transparency */
    background-image: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
}

.fruit-inspiration {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.inspiration-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Gallery Mode */
.gallery-mode {
    display: none;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gallery-mode.active {
    display: flex;
}

.gallery-header {
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.3rem;
}

.gallery-header p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex: 1;
    overflow-y: auto;
}

.drawing-item {
    background: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    transition: transform 0.2s ease;
}

.drawing-item:hover {
    transform: translateY(-2px);
}

.drawing-image {
    width: 100%;
    height: 150px;
    overflow: visible;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: none;
}

.drawing-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.drawing-info {
    padding: 12px;
    background: none;
}

.drawing-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #6c757d;
}

.drawing-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.rate-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.rate-btn:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.thumbs-up-btn:hover {
    background: #d4edda;
    border-color: #c3e6cb;
}

.thumbs-down-btn:hover {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.drawing-date {
    font-size: 11px;
    color: #adb5bd;
    text-align: center;
}

.no-drawings {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
    background: #fff;
    border-radius: 8px;
    margin: 20px;
    grid-column: 1 / -1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        padding: 20px;
    }
    
    .right-panel {
        padding: 20px;
        align-items: center;
    }
    
    .welcome-message h2 {
        font-size: 2rem;
    }
    
    .funny-message {
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    .action-buttons {
        max-width: 250px;
    }
    
    .action-btn {
        padding: 15px 25px;
        font-size: 1rem;
    }
    
    .leaderboard-widget {
        max-width: 100%;
    }
    
    .draw-toolbar {
        padding: 10px;
    }
    
    .tool-buttons, .color-palette, .brush-sizes {
        gap: 4px;
    }
    
    .tool-btn, .color-btn, .size-btn {
        padding: 6px;
        font-size: 14px;
        min-width: 32px;
        height: 32px;
    }
    
    .draw-controls {
        gap: 6px;
    }
    
    .draw-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .draw-canvas-container {
        margin: 0 10px 10px 10px;
        min-height: 400px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    .drawing-image {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .welcome-message h2 {
        font-size: 1.5rem;
    }
    
    .funny-message {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    
    .action-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .tool-buttons, .color-palette, .brush-sizes {
        gap: 3px;
    }
    
    .tool-btn, .color-btn, .size-btn {
        padding: 4px;
        font-size: 12px;
        min-width: 28px;
        height: 28px;
    }
    
    .draw-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .drawing-image {
        height: 100px;
    }
    
    .floating-drawing {
        width: 60px;
        height: 60px;
    }
    
    /* Rating Modal Mobile */
    .rating-modal-content {
        width: 95%;
        max-width: 350px;
    }
    
    .rating-modal-body {
        padding: 20px;
    }
    
    .rating-drawing-preview img {
        max-width: 150px;
        max-height: 150px;
    }
    
    .rating-buttons {
        gap: 20px;
    }
    
    .rating-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .tool-btn:hover, .color-btn:hover, .size-btn:hover {
        background: #fff;
        border-color: #dee2e6;
        transform: none;
        box-shadow: none;
    }
    
    .tool-btn.active, .color-btn.active, .size-btn.active {
        background: #0078d7;
        border-color: #005a9e;
        color: white;
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 120, 215, 0.3);
    }
    
    .draw-btn:hover {
        background: #0078d7;
        transform: none;
        box-shadow: none;
    }
    
    .draw-btn:active {
        background: #005a9e;
        transform: scale(0.95);
    }
    
    .action-btn:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
    
    .action-btn:active {
        transform: scale(0.95);
    }
    
    .rate-btn:hover {
        background: #f8f9fa;
        transform: none;
    }
    
    .rate-btn:active {
        transform: scale(0.95);
    }
    
    .drawing-item:hover {
        transform: none;
    }
    
    .mini-leaderboard-item:hover {
        transform: none;
    }
}