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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #0a0a0a;
    color: white;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    color: #1f2937;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #1f2937;
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.error-message {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.admin-container {
    min-height: 100vh;
    background: #111827;
    padding: 20px;
}

.admin-header {
    background: white;
    color: #1f2937;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions .btn {
    width: auto;
    padding: 10px 20px;
    margin: 0;
}

.screens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.screen-card {
    background: white;
    color: #1f2937;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.screen-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

.screen-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.screen-info {
    font-size: 14px;
    color: #6b7280;
    margin: 5px 0;
}

.screen-detail-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.screen-info-panel {
    background: white;
    color: #1f2937;
    border-radius: 15px;
    padding: 25px;
}

.screen-info-panel h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

#screenInfoDetails {
    font-size: 14px;
}

#screenInfoDetails > div {
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

#screenInfoDetails > div:last-child {
    border-bottom: none;
}

.image-manager {
    background: white;
    color: #1f2937;
    border-radius: 15px;
    padding: 25px;
}

.image-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.image-manager-header h3 {
    font-size: 18px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.image-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f3f4f6;
    cursor: move;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-item:hover .image-item-overlay {
    opacity: 1;
}

.image-delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.image-delete-btn:hover {
    background: #dc2626;
}

.public-screens-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.public-screen-option {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.public-screen-option:hover {
    background: #f3f4f6;
    border-color: #667eea;
    transform: translateX(4px);
}

.public-screen-option h4 {
    font-size: 16px;
    margin-bottom: 4px;
    color: #1f2937;
}

.public-screen-option p {
    font-size: 12px;
    color: #6b7280;
}

/* ===================================
   UPDATED SLIDESHOW STYLES FOR PORTRAIT SCREENS
   - Fills entire screen using width as reference
   - No black edges on left/right sides
   - Perfect for 1400 x 2400 portrait displays
   - Prevents automatic fullscreen
   =================================== */

.slideshow-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #000;
    overflow: hidden;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.slideshow-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.slideshow-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Fill screen using WIDTH as primary reference for portrait */
    width: 100%;
    height: auto;
    min-height: 100%;
    /* Use cover to fill entire screen - no black bars */
    object-fit: cover;
    object-position: center center;
    opacity: 0;
    /* Prevent any interaction that might trigger fullscreen */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.slideshow-image.active {
    opacity: 1;
}

/* ===================================
   TRANSITION ANIMATIONS
   =================================== */

.transition-fade .slideshow-image {
    transition: opacity 1s ease-in-out;
}

.transition-slide-left .slideshow-image {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.transition-slide-left .slideshow-image.active {
    transform: translate(-50%, -50%) translateX(0);
}

.transition-slide-left .slideshow-image.next {
    transform: translate(-50%, -50%) translateX(100%);
}

.transition-slide-right .slideshow-image {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.transition-slide-right .slideshow-image.active {
    transform: translate(-50%, -50%) translateX(0);
}

.transition-slide-right .slideshow-image.next {
    transform: translate(-50%, -50%) translateX(-100%);
}

.transition-slide-up .slideshow-image {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.transition-slide-up .slideshow-image.active {
    transform: translate(-50%, -50%) translateY(0);
}

.transition-slide-up .slideshow-image.next {
    transform: translate(-50%, -50%) translateY(100%);
}

.transition-slide-down .slideshow-image {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.transition-slide-down .slideshow-image.active {
    transform: translate(-50%, -50%) translateY(0);
}

.transition-slide-down .slideshow-image.next {
    transform: translate(-50%, -50%) translateY(-100%);
}

.transition-zoom .slideshow-image {
    transition: transform 1s ease-in-out, opacity 1s ease-in-out;
}

.transition-zoom .slideshow-image.active {
    transform: translate(-50%, -50%) scale(1);
}

.transition-zoom .slideshow-image.next {
    transform: translate(-50%, -50%) scale(0.5);
}

.transition-flip .slideshow-image {
    transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

.transition-flip .slideshow-image.active {
    transform: translate(-50%, -50%) rotateY(0deg);
}

.transition-flip .slideshow-image.next {
    transform: translate(-50%, -50%) rotateY(90deg);
}

.transition-rotate .slideshow-image {
    transition: transform 1s ease-in-out, opacity 1s ease-in-out;
}

.transition-rotate .slideshow-image.active {
    transform: translate(-50%, -50%) rotate(0deg);
}

.transition-rotate .slideshow-image.next {
    transform: translate(-50%, -50%) rotate(180deg);
}

.transition-blur .slideshow-image {
    transition: filter 1s ease-in-out, opacity 1s ease-in-out;
}

.transition-blur .slideshow-image.active {
    filter: blur(0px);
}

.transition-blur .slideshow-image.next {
    filter: blur(20px);
}

.transition-crossfade .slideshow-image {
    transition: opacity 1.5s ease-in-out;
}

.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    color: white;
    z-index: 100;
}

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

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

.screen-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 10;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    color: #1f2937;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 22px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #1f2937;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-actions .btn {
    flex: 1;
}

@media (max-width: 768px) {
    .screen-detail-content {
        grid-template-columns: 1fr;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
