/* Reset och baseline */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* App layout */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: white;
}

/* Header */
.app-header {
    background: #000;
    color: white;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.header-content h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.header-content p {
    font-size: 13px;
    color: #999;
    font-weight: 400;
}

.header-stats {
    display: flex;
    gap: 32px;
    font-size: 13px;
    color: #999;
}

.header-stats strong {
    color: white;
    font-weight: 600;
}

/* Machines section */
.machines-section {
    padding: 24px 32px;
}

.machines-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));
    gap: 20px;
    max-width: 100%;
}

/* Main container */
.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

/* Media panel */
.media-panel {
    display: flex;
    flex-direction: column;
    padding: 32px;
    background: white;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
}

.media-panel h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1a1a1a;
}

/* Upload area */
.upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    margin-bottom: 24px;
}

.upload-area:hover {
    border-color: #1a1a1a;
    background: white;
}

.upload-area.dragover {
    border-color: #1a1a1a;
    background: #f0f0f0;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.05);
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 300;
    color: #666;
    line-height: 1;
}

.upload-area p {
    margin: 4px 0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.upload-hint {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

/* Media grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.media-item {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #f0f0f0;
    transition: all 0.2s ease;
    border: 2px solid #e0e0e0;
}

.media-item:hover {
    transform: scale(1.02);
    border-color: #1a1a1a;
}

.media-item.selected {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.15);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

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

.media-item-type {
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.video-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    opacity: 0.9;
    pointer-events: none;
}

.media-delete-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-item:hover .media-delete-btn {
    opacity: 1;
}

.media-delete-btn:hover {
    background: rgba(211, 47, 47, 0.9);
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* Machines panel - now publish panel */
.machines-panel {
    display: flex;
    flex-direction: column;
    padding: 32px;
    background: #fafafa;
    overflow-y: auto;
}

.machines-panel h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1a1a1a;
}

/* Publish panel */
.publish-panel {
    display: flex;
    flex-direction: column;
    padding: 32px;
    background: #fafafa;
    overflow-y: auto;
}

.publish-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.publish-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    flex: 1;
}

.publish-controls {
    display: flex;
    gap: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 20px;
}

.publish-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80px;
}

.publish-info-text {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Machine card */
.machine-card {
    background: transparent;
    border: none;
    padding: 0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.machine-card:hover {
    opacity: 0.9;
}

.machine-card.selected {
    opacity: 1;
}

.machine-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.machine-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.machine-location {
    font-size: 11px;
    color: #999;
}

.machine-status {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 6px;
    border-radius: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    white-space: nowrap;
}

.machine-display {
    aspect-ratio: 3 / 4;
    background: transparent;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    flex-shrink: 0;
}

.machine-display-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
}

.coffee-machine-frame {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.coffee-machine-svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

.display-overlay {
    position: absolute;
    height: 25%;
    aspect-ratio: 16 / 9;
    background: #0a0a0a;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.display-overlay img,
.display-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.display-empty {
    color: #666;
    font-size: 12px;
    text-align: center;
}

.machine-content {
    font-size: 10px;
    color: #666;
    padding: 4px 6px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 6px;
    overflow-y: auto;
    flex: 1;
}

.machine-content-empty {
    color: #999;
    font-style: italic;
}

.machine-content-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 10px;
}

.machine-content-item-type {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    color: #999;
}

.machine-actions {
    display: flex;
    gap: 6px;
}

.btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.btn:hover {
    border-color: #1a1a1a;
    background: #f5f5f5;
}

.btn-primary {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.btn-primary:hover {
    background: #333;
    border-color: #333;
}

.btn-large {
    padding: 12px 24px;
    font-size: 13px;
    flex: 0 0 auto;
    height: 45px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

/* Responsive */
@media (max-width: 1400px) {
    .machines-list {
        grid-template-columns: repeat(auto-fit, minmax(25%, 1fr));
    }
}

@media (max-width: 1200px) {
    .machines-list {
        grid-template-columns: repeat(auto-fit, minmax(33%, 1fr));
    }
    
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .media-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: 50vh;
    }
    
    .publish-panel {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px;
    }
    
    .media-panel,
    .publish-panel,
    .machines-section {
        padding: 16px;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .machines-list {
        grid-template-columns: 1fr;
    }
    
    .publish-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .publish-header .btn-large {
        width: 100%;
    }
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

