* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-image: url('images/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(155, 205, 108, 0.8), rgba(111, 168, 61, 0.8));
    z-index: -1;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 30px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
    color: #333;
    font-size: 1.8rem;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.refresh-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: #5a6fd6;
}

.back-link {
    padding: 10px 20px;
    background: #e0e0e0;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.back-link:hover {
    background: #d0d0d0;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.groups-grid.compact {
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.group-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.group-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.group-card.compact {
    padding: 10px;
    text-align: center;
}

.group-header-compact {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-header-compact .group-name {
    font-size: 1rem;
    font-weight: bold;
    color: #333;
}

.diary-icon {
    font-size: 1.2rem;
    cursor: default;
    transition: all 0.3s ease;
    padding: 4px;
    border-radius: 4px;
}

.diary-icon.has-diary {
    cursor: pointer;
    filter: none;
    opacity: 1;
}

.diary-icon.has-diary:hover {
    transform: scale(1.2);
    background: rgba(93, 135, 54, 0.1);
}

.diary-icon.no-diary {
    filter: grayscale(100%);
    opacity: 0.4;
}

.plant-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plant-name-compact {
    font-size: 0.9rem;
    font-weight: 500;
    color: #5d8736;
    margin-bottom: 4px;
}

.plant-day-compact {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 8px;
}

.plant-image-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.plant-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.plant-display.empty .plant-image-container img {
    opacity: 0.3;
}

.group-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

.group-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.group-info {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    color: #666;
}

.info-value {
    font-weight: 500;
    color: #333;
}

.plant-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: #e8f5e9;
    border-radius: 15px;
    font-size: 0.85rem;
}

.plant-badge img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.diary-preview {
    background: #fef0cf;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
}

.diary-preview p {
    font-size: 0.85rem;
    color: #5a4a3a;
    line-height: 1.4;
}

.view-diary-btn {
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: #5d8736;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s;
}

.view-diary-btn:hover {
    background: #4a6c2b;
}

.view-diary-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.loading {
    text-align: center;
    padding: 50px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 16px;
    color: #721c24;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

#modalTitle {
    margin-bottom: 20px;
    color: #333;
}

#modalBody {
    line-height: 1.6;
}

.diary-content {
    background: #fef0cf;
    border-radius: 16px;
    padding: 20px;
}

.diary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.diary-item {
    background: white;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.diary-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.diary-item .day-label {
    font-size: 0.75rem;
    color: #b47c44;
    margin-bottom: 8px;
}

.diary-item .diary-text {
    font-size: 0.85rem;
    color: #5a4a3a;
}

/* Diary Preview Overlay - Full Screen Style from index */
.diary-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.diary-preview-overlay.show {
    display: flex;
}

.diary-preview-modal {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    animation: previewSlideIn 0.3s ease;
}

@keyframes previewSlideIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.diary-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.diary-preview-header h2 {
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #9bcd6c, #6fa83d);
    padding: 8px 20px;
    border-radius: 25px;
    text-shadow: none;
    margin: 0;
}

.preview-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.preview-close-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.6);
    transform: rotate(90deg);
}

.diary-preview-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    overflow: hidden;
}

.diary-preview-content .diary-template {
    background: linear-gradient(135deg, #fffef5, #fff9e6);
    border-radius: 30px;
    padding: 35px 40px;
    border: 4px solid #ffd966;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1300px;
    width: 100%;
}

.diary-preview-content .diary-layout {
    display: flex;
    gap: 30px;
    margin: 0;
}

.diary-preview-content .diary-tips-column {
    flex: 0 0 220px;
    background: #e8f0da;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diary-preview-content .diary-plant-name-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 2px solid #c8e6c9;
}

.diary-preview-content .diary-tip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.diary-preview-content .diary-divider {
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #d1b38b,
        #d1b38b 5px,
        transparent 5px,
        transparent 10px
    );
    margin-top: 10px;
}

.diary-preview-content .diary-tip-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.diary-preview-content .diary-tip-text {
    font-size: 0.85rem;
    color: #5d4a2e;
    text-align: center;
}

.diary-preview-content .diary-group-info {
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    margin-top: 5px;
    text-align: center;
}

.diary-preview-content .plant-image-container {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.diary-preview-content .plant-image-container img {
    width: 110px;
    height: 110px;
    object-fit: contain;
}

.diary-preview-content .diary-cards-column {
    flex: 1;
}

.diary-preview-content .grid-4-small {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.diary-preview-content .diary-card-small {
    background: #fef5e8;
    border-radius: 0;
    padding: 10px 8px 10px 60px;
    text-align: center;
    box-shadow: 0 3px 0 #e0cfaa;
    border: 2px solid #ffe0b0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.diary-preview-content .diary-card-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 0 #e0cfaa, 0 10px 20px rgba(0,0,0,0.15);
}

.diary-preview-content .diary-card-small::after {
    content: '🔍 Click to view';
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.75rem;
    color: #b47c44;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.diary-preview-content .diary-card-small:hover::after {
    opacity: 1;
}

.diary-preview-content .day-tag {
    position: absolute;
    top: 10px;
    left: 0;
    background-image: url('images/day.png');
    background-size: 100%;
    background-repeat: no-repeat;
    color: #5d3a1a;
    padding: 6px 14px;
    font-weight: bold;
    font-size: 0.85rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 32px;
}

/* 如果 day-tag 在 day-tag-wrapper 内，需要相对于卡片定位 */
.diary-preview-content .day-tag-wrapper {
    position: static;
}

.day-tag-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pronounce-icon {
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    filter: grayscale(50%);
    z-index: 11;
    pointer-events: auto; /* Ensure independent click handling */
    display: inline-block;
}

/* Prevent click from passing to parent card */
.pronounce-icon:active {
    transform: scale(0.95);
}

.pronounce-icon:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.2);
}

.pronounce-icon.playing {
    opacity: 1;
    filter: grayscale(0%);
    animation: soundWave 0.6s ease-in-out infinite;
}

@keyframes soundWave {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

.diary-preview-content .photo-area {
    background: white;
    border-radius: 0;
    padding: 12px;
    margin: 8px 0;
    min-height: 100px;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid #ffb347;
}

.diary-preview-content .diary-plant-img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.1));
}

.diary-preview-content .sentence {
    background: #fff6e6;
    border-radius: 0;
    padding: 10px;
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #5d4a2e;
}

.diary-preview-content .sentence-text {
    display: inline;
}

.diary-preview-content .sentence-highlight {
    background: linear-gradient(135deg, #fff3cc, #ffe082);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    color: #5d4a2e;
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .diary-preview-content {
        padding: 15px 20px;
    }
    
    .diary-preview-content .diary-template {
        padding: 15px;
    }
    
    .diary-preview-content .diary-layout {
        flex-direction: column;
    }
    
    .diary-preview-content .diary-tips-column {
        flex: none;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .diary-preview-content .diary-plant-name-item,
    .diary-preview-content .diary-tip-item {
        flex-direction: column;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .diary-preview-content .diary-divider {
        display: none;
    }
    
    .diary-preview-content .plant-image-container {
        display: none;
    }
    
    .diary-preview-content .diary-card-small {
        padding: 8px 8px 8px 50px;
    }
    
    .diary-preview-content .diary-plant-img {
        height: 70px;
    }
}

@media (max-width: 600px) {
    .diary-preview-header {
        padding: 10px 15px;
    }
    
    .diary-preview-header h2 {
        font-size: 1rem;
        padding: 6px 15px;
    }
    
    .preview-close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .diary-preview-content {
        padding: 10px;
    }
    
    .diary-preview-content .diary-template {
        padding: 10px;
        border-radius: 20px;
    }
    
    .diary-preview-content .diary-tips-column {
        padding: 10px;
        gap: 10px;
    }
    
    .diary-preview-content .grid-4-small {
        gap: 8px;
    }
    
    .diary-preview-content .diary-card-small {
        padding: 6px 6px 6px 45px;
    }
    
    .diary-preview-content .day-tag {
        font-size: 0.7rem;
        min-width: 70px;
        height: 28px;
        padding: 5px 10px;
    }
    
    .diary-preview-content .photo-area {
        padding: 10px;
        min-height: 80px;
    }
    
    .diary-preview-content .diary-plant-img {
        height: 60px;
    }
    
    .diary-preview-content .sentence {
        font-size: 0.75rem;
        padding: 8px;
    }
}

/* Slideshow Overlay - Full Screen Style from index */
.diary-slideshow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 4000;
}

.diary-slideshow-overlay.show {
    display: flex;
}

.diary-slideshow-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.slideshow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.slideshow-page-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    padding: 8px 20px;
    border-radius: 25px;
}

.slideshow-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.slideshow-close-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.6);
    transform: rotate(90deg);
}

.slideshow-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    overflow: hidden;
}

.slideshow-card {
    background: #fff9ef;
    border-radius: 30px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 4px solid #ffd966;
    animation: slideIn 0.4s ease;
    position: relative;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.slideshow-card .day-tag {
    position: absolute;
    top: 25px;
    left: 0;
    background-image: url('images/day.png');
    background-size: 100%;
    background-repeat: no-repeat;
    color: #5d3a1a;
    padding: 14px 28px;
    font-weight: bold;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    height: 55px;
}

.slideshow-card .photo-area {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin: 30px auto;
    min-height: 250px;
    max-width: 60%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid #ffb347;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.slideshow-card .diary-plant-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.1));
}

.slideshow-card .sentence {
    background: #fff6e6;
    border-radius: 20px;
    padding: 25px 30px;
    margin-top: 20px;
    font-size: 1.4rem;
    line-height: 1.8;
    color: #5d4a2e;
    border: 2px solid #ffe0b0;
}

.slideshow-card .sentence-highlight {
    background: linear-gradient(135deg, #fff3cc, #ffe082);
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    color: #5d4a2e;
    display: inline-block;
    margin: 2px;
}

.slideshow-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.slideshow-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(111, 191, 76, 0.4);
}

.slideshow-nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(111, 191, 76, 0.6);
}

.slideshow-nav-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.slideshow-nav-btn .nav-text {
    font-size: 0.9rem;
}

.slideshow-dots {
    display: flex;
    gap: 12px;
}

.slideshow-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slideshow-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.slideshow-dot.active {
    background: #6fbf4c;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(111, 191, 76, 0.5);
}

@media (max-width: 700px) {
    .slideshow-header {
        padding: 10px 15px;
    }
    
    .slideshow-page-indicator {
        font-size: 1rem;
        padding: 6px 15px;
    }
    
    .slideshow-close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .slideshow-content {
        padding: 15px;
    }
    
    .slideshow-card {
        padding: 25px 15px;
        border-radius: 20px;
    }
    
    .slideshow-card .day-tag {
        font-size: 1rem;
        min-width: 100px;
        height: 40px;
        padding: 8px 16px;
    }
    
    .slideshow-card .photo-area {
        padding: 15px;
        min-height: 150px;
        margin: 20px auto;
    }
    
    .slideshow-card .diary-plant-img {
        height: 120px;
    }
    
    .slideshow-card .sentence {
        font-size: 1rem;
        padding: 15px;
    }
    
    .slideshow-navigation {
        padding: 15px 20px;
    }
    
    .slideshow-nav-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Toast Message */
.toast-msg {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 4000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Clear Data Button */
.clear-data-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.clear-data-btn:hover {
    background: #c82333;
}

/* Password Modal */
.password-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5000;
    justify-content: center;
    align-items: center;
}

.password-modal-overlay.show {
    display: flex;
}

.password-modal {
    background: white;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-radius: 16px 16px 0 0;
}

.password-modal-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.password-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.password-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.password-modal-content {
    padding: 25px;
}

.password-warning {
    color: #dc3545;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8d7da;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
}

.password-warning-text {
    font-size: 1rem;
    color: #5d4a2e;
    margin: 10px 0;
    line-height: 1.6;
}

.password-warning-sub {
    font-size: 0.95rem;
    color: #888;
    margin: 15px 0 20px 0;
    font-style: italic;
}

.password-input-group {
    margin-bottom: 20px;
}

.password-input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.password-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.password-input:focus {
    outline: none;
    border-color: #dc3545;
}

.password-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.password-cancel-btn {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.password-cancel-btn:hover {
    background: #5a6268;
}

.password-confirm-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.password-confirm-btn:hover {
    background: #c82333;
}

@media (max-width: 1200px) {
    .groups-grid.compact {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 992px) {
    .groups-grid.compact {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .diary-layout {
        grid-template-columns: 1fr;
    }
    
    .diary-tips-column {
        order: 2;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .groups-grid.compact {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .diary-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-4-small {
        grid-template-columns: 1fr;
    }
    
    .diary-preview-modal {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .diary-preview-header {
        border-radius: 0;
        padding: 10px 20px;
    }
    
    .diary-preview-content {
        padding: 15px 20px;
    }
    
    .diary-template {
        max-width: 100%;
    }
}

/* ================= Evaluation Styles ================= */
.header-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.eval-icon {
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.eval-icon:hover {
    transform: scale(1.2);
}

.eval-stars-count {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #5d4a2e;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
}

.eval-stars-count:empty {
    display: none;
}

/* Teacher Evaluation Modal - Full Dashboard Area */
.evaluation-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 6000;
    justify-content: center;
    align-items: center;
}

.evaluation-modal-overlay.show {
    display: flex;
}

.eval-teacher-modal {
    width: 95vw;
    height: 95vh;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 20px;
    overflow: hidden;
}

.evaluation-modal-header {
    flex-shrink: 0;
    padding: 20px 30px;
    background: linear-gradient(135deg, #ffd700, #ffb347);
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.evaluation-modal-header h3 {
    color: #5d4a2e;
    margin: 0;
    font-size: 1.5rem;
}

.evaluation-modal-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: #5d4a2e;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.evaluation-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.evaluation-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    min-height: 0;
}

.start-eval-section {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(111, 191, 76, 0.1), rgba(93, 166, 62, 0.1));
    border-radius: 15px;
}

/* Teacher Demo Rating Section */
.teacher-demo-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff9ef;
    border-radius: 12px;
    border: 2px solid #ffe082;
}

.teacher-demo-section h4 {
    margin: 0 0 15px 0;
    color: #5d4a2e;
    font-size: 1.2rem;
}

.demo-rating-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
}

.demo-criteria-info {
    flex: 1;
}

.demo-criteria-name {
    font-weight: bold;
    color: #5d4a2e;
    font-size: 0.95rem;
}

.demo-criteria-label {
    font-size: 0.8rem;
    color: #888;
}

.demo-icons {
    display: flex;
    gap: 8px;
}

.demo-icon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.4;
    filter: grayscale(100%);
    border-radius: 8px;
}

.demo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.demo-icon:hover {
    transform: scale(1.1);
    opacity: 0.7;
}

.demo-icon.selected {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.1);
}

.start-eval-btn {
    padding: 18px 50px;
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(111, 191, 76, 0.3);
}

.start-eval-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(111, 191, 76, 0.6);
}

.start-eval-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Real-time Results Section */
.realtime-results-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 3px dashed #ffe082;
}

.realtime-results-section > h4 {
    margin: 0 0 15px 0;
    color: #5d4a2e;
    font-size: 1.3rem;
    border-bottom: 2px solid #ffe082;
    padding-bottom: 10px;
}

.eval-progress-summary {
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(111, 191, 76, 0.3);
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.progress-label {
    font-weight: bold;
    font-size: 1.1rem;
}

.progress-value {
    font-size: 1.4rem;
    font-weight: bold;
}

.eval-criteria-results {
    margin-bottom: 15px;
}

.criteria-result-row {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #fff9ef;
    border-radius: 10px;
    border: 2px solid #ffe082;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.criteria-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #ffe082;
}

.criteria-name {
    font-weight: bold;
    color: #5d4a2e;
    font-size: 0.95rem;
}

.criteria-count {
    font-size: 0.95rem;
    color: #6fbf4c;
    font-weight: bold;
}

.criteria-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 40px;
    align-items: center;
    max-height: 120px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}

.criteria-icons img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.criteria-icons img:hover {
    transform: scale(1.15);
}

.criteria-icons .no-icons {
    color: #999;
    font-style: italic;
    font-size: 1rem;
}

/* Participants Grid */
.eval-participants {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed #ffe082;
}

.participants-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.participant-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-height: 70px;
    justify-content: center;
}

.participant-item.voted {
    background: #e8f5e0;
    border: 2px solid #6fbf4c;
    transform: scale(1.02);
}

.participant-item.target {
    background: #fff3cc;
    border: 2px solid #ffb347;
    box-shadow: 0 2px 8px rgba(255, 179, 71, 0.4);
}

.participant-num {
    font-weight: bold;
    color: #5d4a2e;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.participant-status {
    font-size: 1.5rem;
}

.eval-summary-grid {
    display: grid;
    gap: 15px;
}

.eval-criteria-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    padding: 15px;
    background: #fff9ef;
    border-radius: 12px;
    border: 2px solid #ffe082;
}

.eval-criteria-name {
    font-weight: bold;
    color: #5d4a2e;
}

.eval-criteria-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: normal;
}

.eval-criteria-stars {
    text-align: center;
    font-size: 1.2rem;
}

.eval-criteria-icons {
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.eval-result-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.eval-small-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

.eval-criteria-avg {
    text-align: right;
    color: #6fbf4c;
    font-weight: bold;
}

.eval-total-votes {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    color: white;
    border-radius: 12px;
    font-weight: bold;
    margin-top: 10px;
}

.eval-details-list {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.eval-result-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.eval-result-item:last-child {
    border-bottom: none;
}

.evaluation-modal-buttons {
    padding: 15px 25px;
    text-align: center;
    border-top: 2px solid #f0f0f0;
}

.evaluation-publish-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #6fbf4c, #5da63e);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.evaluation-publish-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(111, 191, 76, 0.5);
}
