/* E-Ink Display Control - Stylesheet */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: #34495e;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Dashboard */
.dashboard h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.status-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.status-indicator.active {
    background-color: #27ae60;
    color: white;
}

.status-indicator.idle {
    background-color: #95a5a6;
    color: white;
}

.status-indicator.clock {
    background-color: #9b59b6;
    color: white;
}

.status-details p {
    margin: 0.5rem 0;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.item-type {
    background-color: #3498db;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.25rem;
}

/* Item type specific colors */
.item-type.type-text_only {
    background-color: #3498db;
}

.item-type.type-image_only {
    background-color: #e74c3c;
}

.item-type.type-clock_with_image {
    background-color: #9b59b6;
}

.item-type.type-clock_with_text {
    background-color: #27ae60;
}

.item-type.type-clock,
.item-type.type-alert {
    background-color: #f39c12;
}

.item-priority {
    background-color: #e74c3c;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.item-status {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending { background-color: #f39c12; color: white; }
.status-active { background-color: #27ae60; color: white; }
.status-completed { background-color: #95a5a6; color: white; }
.status-cancelled { background-color: #e74c3c; color: white; }

/* Item Card - Compact */
.item-card {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Item Header */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Item Body - Two Column Layout */
.item-body {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.item-thumbnail {
    flex: 0 0 120px;
    min-width: 120px;
}

.item-thumbnail .thumbnail-img {
    width: 100%;
    height: auto;
    max-height: 80px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #ddd;
    image-rendering: pixelated;
    object-fit: cover;
}

.item-thumbnail .thumbnail-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.item-content {
    flex: 1;
    min-width: 0;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
}

.item-content-full {
    flex: 1 1 100%;
}

.item-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    color: #333;
    max-height: 80px;
    overflow-y: auto;
}

/* Item Footer - Three Column Layout */
.item-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #7f8c8d;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.item-footer .item-duration {
    font-weight: 500;
    color: #555;
}

.item-footer .item-time {
    color: #666;
}

.item-footer .footer-separator {
    color: #bdc3c7;
    font-weight: 300;
}

.item-scheduled {
    color: #7f8c8d;
}

/* Buttons */
.btn-cancel {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-cancel:hover {
    background-color: #c0392b;
}

/* Timeline */
.timeline-controls {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.inline-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-form input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 80px;
}

.inline-form button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.inline-form button:hover {
    background-color: #2980b9;
}

.timeline-info {
    margin-top: 1rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.timeline-items {
    position: relative;
    padding-left: 2rem;
}

.timeline-items::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #ddd;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -2.1rem;
    top: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #3498db;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #3498db;
}

.timeline-item.status-completed .timeline-dot {
    background-color: #95a5a6;
    box-shadow: 0 0 0 2px #95a5a6;
}

.timeline-item.status-cancelled .timeline-dot {
    background-color: #e74c3c;
    box-shadow: 0 0 0 2px #e74c3c;
}

/* Timeline type colors - higher specificity to override status colors */
.timeline-item.type-text_only > .timeline-dot {
    background-color: #3498db;
    box-shadow: 0 0 0 2px #3498db;
}

.timeline-item.type-image_only > .timeline-dot {
    background-color: #e74c3c;
    box-shadow: 0 0 0 2px #e74c3c;
}

.timeline-item.type-clock_with_image > .timeline-dot {
    background-color: #9b59b6;
    box-shadow: 0 0 0 2px #9b59b6;
}

.timeline-item.type-clock_with_text > .timeline-dot {
    background-color: #27ae60;
    box-shadow: 0 0 0 2px #27ae60;
}

.timeline-item.type-clock > .timeline-dot,
.timeline-item.type-alert > .timeline-dot {
    background-color: #f39c12;
    box-shadow: 0 0 0 2px #f39c12;
}

.timeline-content {
    padding-left: 0;
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.history-table thead {
    background-color: #2c3e50;
    color: white;
}

.history-table th,
.history-table td {
    padding: 1rem;
    text-align: left;
}

.history-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
}

.history-table tbody tr.failed {
    background-color: #fee;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.success {
    background-color: #27ae60;
    color: white;
}

.status-badge.failed {
    background-color: #e74c3c;
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.pagination a {
    background-color: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
}

.pagination a:hover {
    background-color: #2980b9;
}

.page-info {
    color: #7f8c8d;
}

/* History Controls */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-controls .inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

.jump-to-page input[type="number"] {
    width: 70px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.jump-to-page button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.jump-to-page button:hover {
    background-color: #2980b9;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #95a5a6;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state small {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-cta {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #555;
}

/* Item Card */
.item-card {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Item Header */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Item Body - Two Column Layout */
.item-body {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.item-thumbnail {
    flex: 0 0 120px;
    min-width: 120px;
}

.item-thumbnail .thumbnail-img {
    width: 100%;
    height: auto;
    max-height: 80px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #ddd;
    image-rendering: pixelated;
    object-fit: cover;
}

.item-thumbnail .thumbnail-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-content-full {
    flex: 1 1 100%;
}

.item-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    color: #333;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    max-height: 80px;
    overflow-y: auto;
}

/* Item Footer - Three Column Layout */
.item-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #7f8c8d;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.item-footer .item-duration {
    font-weight: 500;
    color: #555;
}

.item-footer .item-time {
    color: #666;
}

.item-footer .footer-separator {
    color: #bdc3c7;
    font-weight: 300;
}

/* Item Source Badge */
.item-source {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-left: auto;
    padding-left: 0.5rem;
}

.item-source.preview-badge {
    color: #e67e22;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
    image-rendering: pixelated;
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
}

.modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1rem;
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 70vh;
    }

    .modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .thumbnail-img {
        max-width: 150px;
        max-height: 90px;
    }
}
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .item-footer {
        flex-direction: row;
        align-items: flex-start;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .history-controls .inline-form {
        justify-content: space-between;
    }
}

/* Display Preview */
.display-preview {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.display-frame {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: #f0f0f0;
    border: 4px solid #333;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    aspect-ratio: 800 / 480;
    overflow: hidden;
}

.display-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    image-rendering: pixelated;
}

.display-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #95a5a6;
    text-align: center;
    padding: 2rem;
}

.display-placeholder p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.display-placeholder small {
    font-size: 0.9rem;
}

.display-info {
    text-align: center;
    margin-top: 0.75rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .display-preview {
        padding: 1rem;
    }

    .display-frame {
        border-width: 2px;
    }
}
