/* =============================================================================
   JAIL OR NO JAIL - CORE CSS
   ============================================================================= */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(to right, #2e8b57 33.33%, #f5f5dc 33.33%, #f5f5dc 66.66%, #dc143c 66.66%);
    background-attachment: fixed;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* =============================================================================
   SCREEN NAVIGATION
   ============================================================================= */

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: none;
    flex-direction: column;
    background: transparent;
}

.screen.active {
    display: flex;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

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

/* =============================================================================
   UPLOAD SCREEN
   ============================================================================= */

.upload-screen {
    /* Inherits background from body */
}

.upload-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    text-align: center;
    overflow-y: auto;
    min-height: 0;
}

/* Logo Section */
.logo-section {
    flex-shrink: 0;
}

.logo {
    width: 160px;
    height: 160px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.app-logo {
    padding: 15px;
    display: inline-block;
}

.logo-text {
    margin: 0;
    line-height: 0.9;
}

.logo-jail-top {
    font-size: 2.8em;
    font-weight: 900;
    color: #2e8b57;
    text-shadow: 3px 3px 0px #000;
    margin: 0;
}

.logo-or-no {
    font-size: 1.6em;
    font-weight: 900;
    color: #000;
    text-shadow: 2px 2px 0px #fff;
    margin: 0;
}

.logo-jail-bottom {
    font-size: 2.8em;
    font-weight: 900;
    color: #dc143c;
    text-shadow: 3px 3px 0px #000;
    margin: 0;
}

/* Judge Selection */
.select-judge-text {
    font-family: 'Alfa Slab One', serif;
    color: white;
    font-size: 1.8em;
    font-weight: normal;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.judges-grid {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.judge-card {
    background: white;
    border: 4px solid #2e8b57;
    border-radius: 15px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 100px;
}

.judge-card:hover {
    transform: scale(1.05);
}

.judge-card.selected {
    border-color: #dc143c;
    background: #ffe6e6;
    transform: scale(1.05);
}

.judge-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 6px;
}

.judge-name {
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    margin: 0;
    text-align: center;
}

/* Content Preview Section */
.content-section {
    width: 100%;
    max-width: 400px;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    min-height: 0;
}

.show-content-text {
    font-family: 'Alfa Slab One', serif;
    color: white;
    font-size: 1.8em;
    font-weight: normal;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.content-preview-container {
    flex: 1;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.9);
    border: 4px dashed #333;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.content-preview-container.has-image {
    border-style: solid;
    border-color: #2e8b57;
    background: white;
}

.preview-placeholder {
    color: #666;
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.preview-placeholder-icon {
    font-size: 3em;
    opacity: 0.5;
}

.preview-image {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    display: none;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.preview-image.visible {
    display: block;
}

/* Photo Controls */
.photo-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    width: 100%;
    flex-shrink: 0;
}

.photo-controls button {
    font-family: 'Bebas Neue', serif;
    flex: 1;
    padding: 16px;
    border: 3px solid #333;
    border-radius: 20px;
    font-size: 16px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background: #f5f5dc;
    color: #333;
    text-transform: none;
    letter-spacing: 1px;
}

.btn-camera {
    background: #f5f5dc;
    color: #333;
}

.btn-camera:active {
    transform: scale(0.95);
}

.btn-upload {
    background: #f5f5dc;
    color: #333;
}

.btn-upload:active {
    transform: scale(0.95);
}

/* Analyze Button */
.analyze-btn {
    font-family: 'Alfa Slab One', serif;
    width: 100%;
    max-width: 400px;
    background: #dc143c;
    color: white;
    border: 3px solid #333;
    padding: 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 20px;
    font-weight: normal;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    flex-shrink: 0;
}

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

.analyze-btn:not(:disabled):active {
    transform: scale(0.95);
}

.file-input {
    display: none;
}

/* =============================================================================
   RESULTS SCREEN
   ============================================================================= */

.results-screen {
    padding: 20px;
    overflow-y: auto;
}

.results-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.back-btn {
    position: absolute;
    top: -10px;
    left: -10px;
    background: rgba(255,255,255,0.9);
    border: 2px solid #333;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #333;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.back-btn:active {
    transform: scale(0.9);
}

.results-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* Verdict Card Design */
.verdict-card {
    width: 100%;
    max-width: 450px;
    background: white;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
    border: 4px solid #333;
    margin-bottom: 30px;
}

/* Photo section - takes up top half */
.card-photo-section {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.card-content-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.verdict-badge {
    font-family: 'Alfa Slab One', serif;
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 2.2em;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 3px solid white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.jail-result .verdict-badge {
    background: #dc143c;
    color: white;
}

.safe-result .verdict-badge {
    background: #2e8b57;
    color: white;
}

/* Verdict details section - takes up bottom half */
.card-details-section {
    padding: 15px;
    background: white;
    position: relative;
    min-height: 120px;
}

.judge-avatar-section {
    position: relative;
    float: right;
    top: -60px;
    z-index: 5;
}

.judge-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.verdict-info {
    display: block;
}

.jail-result .card-details-section {
    background: #dc143c;
}

.safe-result .card-details-section {
    background: #2e8b57;
}

.verdict-crime {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
    letter-spacing: 0px;
}

.verdict-sentence {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    letter-spacing: 0px;
}

.verdict-reasoning {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95em;
    line-height: 1.4;
    color: white;
    font-style: italic;
    font-weight: 400;
    margin: 0;
    letter-spacing: 0px;
}

.results-bottom-buttons {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
    max-width: 450px;
}

.share-result-btn, .generate-video-btn {
    font-family: 'Bebas Neue', serif;
    background: #f5f5dc;
    color: #333;
    border: 3px solid #333;
    padding: 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px;
    font-weight: normal;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-transform: none;
    letter-spacing: 1px;
}

.share-result-btn {
    flex: 1;
}

.generate-video-btn {
    flex: 2;
}

.share-result-btn:active, .generate-video-btn:active {
    transform: scale(0.95);
}

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

/* Special styles for html2canvas capture */
.share-capture {
    background: linear-gradient(to right, #2e8b57 33.33%, #f5f5dc 33.33%, #f5f5dc 66.66%, #dc143c 66.66%) !important;
    opacity: 1 !important;
    -webkit-background-clip: padding-box !important;
    background-clip: padding-box !important;
}

.share-capture * {
    opacity: 1 !important;
}

.share-capture .back-btn {
    display: none !important;
}

.share-capture .results-bottom-buttons {
    display: none !important;
}

.share-capture .verdict-card {
    background: white !important;
    opacity: 1 !important;
}

.share-capture .card-details-section.jail-result {
    background: #dc143c !important;
    opacity: 1 !important;
}

.share-capture .card-details-section.safe-result {
    background: #2e8b57 !important;
    opacity: 1 !important;
}

/* =============================================================================
   VIDEO SCREEN
   ============================================================================= */

.video-screen {
    background: #000;
}

.video-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.share-controls {
    position: absolute;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
}

.share-btn {
    background: rgba(0,0,0,0.7);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: white;
    backdrop-filter: blur(10px);
}

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

.share-btn:hover {
    background: rgba(0,0,0,0.9);
}

.video-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.video-back-btn:active {
    transform: scale(0.9);
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* =============================================================================
   LOADING AND ERROR STATES
   ============================================================================= */

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    font-size: 1.2em;
    text-align: center;
    padding: 0 20px;
}

.error {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #ff4757;
    color: white;
    padding: 15px;
    border-radius: 12px;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.error.hidden {
    display: none;
}

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

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

/* Desktop adjustments */
@media (min-width: 768px) {
    .btn-camera {
        display: block;
    }
    .btn-upload {
        width: 100%;
        max-width: none;
    }
    .judges-grid {
        gap: 15px;
    }
    .judge-card {
        width: 120px;
        padding: 10px;
    }
    .judge-image {
        height: 100px;
    }
    .judge-name {
        font-size: 0.9em;
    }
    .logo {
        width: 140px;
        height: 140px;
    }
    .logo-jail-top, .logo-jail-bottom {
        font-size: 3.2em;
    }
    .logo-or-no {
        font-size: 1.8em;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .upload-container {
        padding: 15px;
    }
    
    .logo-jail-top, .logo-jail-bottom {
        font-size: 2.4em;
    }
    
    .logo-or-no {
        font-size: 1.4em;
    }
    
    .select-judge-text, .show-content-text {
        font-size: 1.5em;
    }
    
    .judges-grid {
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .judge-card {
        width: 85px;
        padding: 6px;
    }
    
    .judge-image {
        height: 70px;
    }
    
    .judge-name {
        font-size: 0.75em;
    }
    
    .content-preview-container {
        min-height: 180px;
    }
    
    .preview-placeholder {
        font-size: 1em;
        padding: 15px;
    }
    
    .preview-placeholder-icon {
        font-size: 2.5em;
    }
    
    .photo-controls button {
        padding: 14px;
        font-size: 14px;
    }
    
    .analyze-btn {
        padding: 18px;
        font-size: 18px;
    }
    
    /* Results screen mobile */
    .results-screen {
        padding: 15px;
    }
    
    .card-photo-section {
        height: 250px;
    }
    
    .verdict-badge {
        font-size: 2em;
        padding: 8px 15px;
        top: 15px;
        right: 15px;
    }
    
    .card-details-section {
        padding: 15px;
        min-height: 100px;
    }
    
    .judge-avatar-section {
        top: -65px;
    }
    
    .judge-avatar {
        width: 100px;
        height: 100px;
    }
    
    .verdict-crime, .verdict-sentence {
        font-size: 1em;
    }
    
    .verdict-reasoning {
        font-size: 0.9em;
    }
    
    .results-bottom-buttons {
        flex-direction: row;
        gap: 10px;
    }
}

/* =============================================================================
   IOS SPECIFIC FIXES
   ============================================================================= */

@supports (-webkit-touch-callout: none) {
    .video-player {
        -webkit-playsinline: true;
        playsinline: true;
    }
}

/* =============================================================================
   APP-SPECIFIC THEME OVERRIDES
   ============================================================================= */

/* Food app (default) */
.jail-app-food {
    background: linear-gradient(to right, #2e8b57 33.33%, #f5f5dc 33.33%, #f5f5dc 66.66%, #dc143c 66.66%);
}

/* Parking app */
.jail-app-parking {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 50%, #1a202c 100%);
}

/* Fashion app */
.jail-app-fashion {
    background: linear-gradient(45deg, #ff6b9d, #c44569, #f8b500, #feca57);
}

/* Add more app-specific themes as needed */