/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #eee;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #2a2a4a;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-badge {
    background: #e94560;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.header-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #e94560;
}

.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

/* Main Content */
.main {
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Control Cards */
.control-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.control-card {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #2a2a4a;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.card-icon {
    font-size: 20px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 500;
}

/* Stream Container */
.stream-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.stream-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stream-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
}

.live-badge {
    background: #e94560;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Stats Card */
.stats-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a1a2e 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stat-box .value {
    font-size: 24px;
    font-weight: 600;
    color: #e94560;
}

.stat-box .label {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

/* API List */
.api-list {
    font-size: 12px;
    color: #888;
    line-height: 1.8;
}

.api-list code {
    background: rgba(233, 69, 96, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e94560;
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #e94560;
    color: white;
}

.btn-primary:hover {
    background: #c23152;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #2a2a4a;
    color: #eee;
}

.btn-secondary:hover {
    background: #3a3a5a;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.refresh-info {
    color: #888;
    font-size: 13px;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.image-card {
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #2a2a4a;
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(233, 69, 96, 0.2);
}

.image-link {
    display: block;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-card:hover .image-link img {
    transform: scale(1.05);
}

.image-info {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
}

.btn-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: #dc3545;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #555;
    grid-column: 1 / -1;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: #444;
    border-top: 1px solid #1a1a2e;
    margin-top: 40px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1a2e;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid #e94560;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s;
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.success {
    border-left-color: #28a745;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #e94560;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-stats {
        width: 100%;
        justify-content: space-around;
    }

    .control-cards {
        grid-template-columns: 1fr;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .card-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
