/* Landing Page Style Theme - Matching Landing Page Design */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    color: #333;
    line-height: 1.6;
}

/* Clean gradient background matching landing page */
.gradient-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Subtle overlay pattern */
.gradient-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* Keep original three-column app layout */
.app-layout {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
    padding: 10px;
    gap: 15px;
}

/* Left sidebar - Text Controls - wider now */
.left-sidebar {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* Right sidebar - Detected Faces - much narrower */
.right-sidebar {
    width: 200px;
    flex-shrink: 0;
    overflow-y: auto;
}

/* Header title styling - matching landing page */
.title-frame {
    background: white;
    border-radius: 10px;
    padding: 8px 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    text-align: center;
}

/* App logo styling */
.app-logo {
    max-width: 100%;
    height: auto;
    max-height: 50px;
    display: block;
    margin: 0 auto;
}

h1.title,
.title-frame .title,
.title-frame h1 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
    margin: 0 !important;
    letter-spacing: -0.5px !important;
    text-transform: uppercase !important;
}

/* Card styling matching landing page */
.card,
.controls-panel,
.page2-frame,
.faces-panel {
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.card:hover,
.controls-panel:hover,
.page2-frame:hover,
.faces-panel:hover {
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.card-header,
.frame-title,
h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
    color: #333 !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Button styling matching landing page */
button, .btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.btn-primary, button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover, button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary, button.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover, button.secondary:hover {
    background: #667eea;
    color: white;
}

button:disabled,
button[disabled],
.festive-btn:disabled,
.festive-btn[disabled],
.btn-skyblue:disabled,
.btn-skyblue[disabled] {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    background: #cccccc !important;
    color: #666666 !important;
    box-shadow: none !important;
    pointer-events: none !important;
    filter: grayscale(100%) !important;
}

/* Input styling - smaller and more compact */
input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 10px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    transition: all 0.3s;
    background: white !important;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Form groups and controls */
.form-group,
.control-group {
    margin-bottom: 8px;
}

.form-group label,
.control-group label,
label {
    display: block;
    margin-bottom: 5px !important;
    color: #333 !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

.control-group-inline,
.text-inline-controls,
.text-action-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.inline-item,
.control-item {
    flex: 1;
}

small {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    color: #666 !important;
    font-size: 0.75rem !important;
}

/* Login status box */
.login-status-box {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.login-status-text {
    font-size: 0.9rem;
    color: #333;
}

.login-status-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.login-status-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Upload buttons */
.upload-btn,
.upload-new-btn,
.festive-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    border: none !important;
    cursor: pointer !important;
    width: 100%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s !important;
    text-align: center;
}

.upload-btn:hover,
.upload-new-btn:hover,
.festive-btn:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}

/* Button color variants */
.btn-coral { background: linear-gradient(135deg, #FF6B6B, #FF8E53) !important; }
.btn-turquoise { background: linear-gradient(135deg, #4ECDC4, #44A08D) !important; }
.btn-skyblue { background: linear-gradient(135deg, #45B7D1, #3498DB) !important; }
.btn-mint { background: linear-gradient(135deg, #96CEB4, #7DCEA0) !important; }
.btn-purple { background: linear-gradient(135deg, #9B59B6, #8E44AD) !important; }
.btn-yellow { background: linear-gradient(135deg, #FFEAA7, #FDCB6E) !important; color: black !important; }
.btn-plum { background: linear-gradient(135deg, #DDA0DD, #C06C84) !important; }
.btn-orange { background: linear-gradient(135deg, #FF9F43, #EE5A24) !important; }

.upload-new-section {
    margin-bottom: 12px;
}

/* Poster preview */
.poster-preview {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.poster-preview h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* Image frame container - minimal padding */
.image-frame {
    background: white;
    border-radius: 10px;
    padding: 10px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

/* Poster preview - pages side by side */
.dual-page-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px !important;
    justify-content: center !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
}

.page-preview {
    flex: 1 !important;
    max-width: 48% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.page-preview h4 {
    font-size: 0.85rem !important;
    margin: 0 0 5px 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    color: #333 !important;
}

.page-preview canvas {
    max-width: 100% !important;
    max-height: 50vh !important;
    height: auto !important;
    width: auto !important;
}

.canvas-container {
    max-width: 100% !important;
    max-height: 50vh !important;
}

#imageCanvas,
#page2Canvas {
    max-height: 50vh !important;
}

/* Logo upload section */
.logo-upload-section {
    margin-bottom: 8px;
}

.logo-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.logo-upload-btn,
.remove-logo-btn {
    flex: 1;
    padding: 6px 8px !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    text-align: center !important;
    display: inline-block !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    min-height: 28px !important;
}

.logo-upload-btn:hover,
.remove-logo-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

/* Logo preview - minimal height */
.logo-preview {
    margin-top: 6px;
    padding: 6px;
    background: #f5f5f5;
    border-radius: 6px;
    text-align: center;
    min-height: 30px;
}

.logo-img {
    max-width: 100px !important;
    max-height: 28px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

/* Face grid - much smaller thumbnails */
.face-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.face-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 80px;
    max-height: 80px;
}

.face-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.face-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 80px;
    max-height: 80px;
}

/* Button frame for main action buttons - much more compact */
.button-frame {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.button-frame button {
    flex: 1;
    min-width: 90px;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
}

/* Status frame */
.status-frame {
    background: white;
    border-radius: 16px;
    padding: 15px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    text-align: center;
}

.status-text {
    color: #333;
    font-weight: 500;
    font-size: 1rem;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.action-buttons button {
    flex: 1;
    min-width: 120px;
}

/* Color picker */
input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

input[type="color"]:hover {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Range slider */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    border: none;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Alert/notification styling */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

/* Loading spinner */
.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

/* Responsive design */
@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
        height: auto;
    }
    
    .left-sidebar,
    .right-sidebar {
        width: 100%;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #333;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* No Credits Modal Styles */
.credits-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.credits-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.credits-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.credits-modal-header {
    padding: 10px 24px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.credits-modal-header h2 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.credits-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.credits-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.credits-modal-body {
    padding: 24px;
}

.credits-modal-options {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.credits-option-card {
    flex: 1;
    min-width: 200px;
    padding: 24px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
}

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

.credits-option-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.credits-option-card h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.credits-option-card p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #666;
}

.credits-option-divider {
    font-weight: bold;
    color: #999;
    font-size: 14px;
    padding: 0 10px;
}

.credits-btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.credits-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.credits-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.credits-btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.credits-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

@media (max-width: 600px) {
    .credits-modal-options {
        flex-direction: column;
    }
    
    .credits-option-divider {
        transform: rotate(90deg);
    }
}

/* Mobile responsive design - Hide Page 2 elements */
@media (max-width: 768px) {
    /* Stack three-column layout vertically on mobile */
    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    /* Make all columns full width on mobile */
    .left-sidebar,
    .main-content,
    .right-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    /* Adjust main content order - show center column first */
    .main-content {
        order: 1;
    }
    
    .left-sidebar {
        order: 2;
    }
    
    .right-sidebar {
        order: 3;
    }
    
    /* Adjust dual page preview for mobile */
    .dual-page-container {
        flex-direction: column;
        gap: 20px;
        justify-content: center;
    }
    
    .page-preview {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
    
    /* Adjust canvas sizes for mobile */
    .canvas-container {
        position: relative !important;
        display: inline-block !important;
        width: 240px !important;
        height: 371px !important;
    }
    
    #imageCanvas, #page2Canvas,
    .page-preview canvas {
        max-width: 240px !important;
        max-height: 371px !important;
        width: 240px !important;
        height: 371px !important;
    }
    
    #cropOverlay {
        max-width: 240px !important;
        max-height: 371px !important;
        width: 240px !important;
        height: 371px !important;
    }
    
    .drop-zone, .page2-placeholder {
        width: 240px !important;
        height: 371px !important;
        left: 0 !important;
        top: 0 !important;
    }
    
    /* Hide Page 2 elements on mobile - CRITICAL */
    .left-sidebar .page2-frame,
    .page2-frame,
    .page2-frame h3,
    .page2-frame .frame-title,
    .page2-canvas-container,
    .page2-text-controls,
    .logo-upload-section,
    .logo-upload-btn,
    .remove-logo-btn,
    .logo-preview,
    .dual-page-container .page-preview:last-child,
    div.page2-frame,
    div.logo-upload-section,
    div.page2-text-controls {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        max-height: 0 !important;
    }
    
    /* Adjust button sizes for mobile */
    .festive-btn {
        width: auto;
        min-width: 70px;
        max-width: 90px;
        font-size: 10px;
        padding: 5px 6px;
    }
    
    .button-frame {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}
