/* 基础样式 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.child-selector {
    margin: 10px 0;
}

.child-selector select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.alert {
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.alert.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group small {
    color: #666;
    font-size: 0.8em;
}

button {
    padding: 10px 15px;
    background-color: #42a5f5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #1e88e5;
}

/* 孩子列表样式 */
.child-list {
    margin-top: 30px;
}

.child-list ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.child-list li {
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

.child-list li a {
    color: #1565c0;
    text-decoration: none;
    font-weight: bold;
}

.child-list li a:hover {
    text-decoration: underline;
}

/* 媒体网格布局 */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.media-item {
    position: relative;
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.media-item:hover {
    transform: scale(1.03);
}

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

.media-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    opacity: 0.8;
    transition: opacity 0.2s;
}

.media-item:hover .play-icon {
    opacity: 1;
}

.filename {
    padding: 8px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-date {
    padding: 0 8px 8px;
    font-size: 12px;
    color: #666;
}

/* 播放器模态框 */
.player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 1000px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.player-container {
    width: 100%;
    background: black;
}

.player-container video {
    width: 100%;
    max-height: 80vh;
}

.player-container img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
}

.player-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* 列表视图 */
.list-view .media-grid {
    display: block;
}

.list-view .media-item {
    display: flex;
    height: 60px;
    margin-bottom: 10px;
}

.list-view .media-item video, 
.list-view .media-item img {
    width: 100px;
    height: 100%;
}

.list-view .filename {
    flex: 1;
    padding: 20px;
    align-self: center;
}

.list-view .file-date {
    padding: 20px;
    align-self: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .child-selector {
        width: 100%;
        margin-top: 10px;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}