/* styles/studypage/study.css - FULLY UPDATED with Animations */

/* --- Page Structure --- */

.study-main {
    padding-top: 100px;
    min-height: 80vh;
}

.summaries-grid {
    display: grid;
    /* Compact Tiles: minmax(250px, 1fr) for better spacing */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 30px;
    padding: 20px 0;
}

/* --- Card Styles (Minimal Tile) --- */

.summary-card {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 15px; /* Reduced padding for compact tile */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease-in-out; /* Add transition for hover effect */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.summary-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); /* Lift card on hover */
    transform: translateY(-3px); /* Subtle lift animation */
}

.tile-info p {
    margin: 4px 0;
    font-size: 0.9em; 
    color: #444;
    transition: color 0.3s;
}

.summary-card:hover .tile-info p strong {
    color: var(--primary-color, #1a237e); /* Highlight strong text on hover */
}

/* --- Button Styles --- */

.view-summary-btn {
    margin-top: 15px;
    max-width: 200px; 
    align-self: center; 
    padding: 8px 18px; 
    font-size: 0.95em;
    background-color: var(--primary-color, #1a237e);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.view-summary-btn:hover {
    background-color: var(--primary-hover, #0d47a1);
    transform: scale(1.02); /* Pop button slightly on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.view-summary-btn:active {
    transform: scale(0.98); /* Press down effect */
}


/* --- Modal Styles (Virtual Window) with Animations --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    /* Initial state for slide-in animation */
    transform: translateY(-50px) scale(0.95); 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active .modal-content {
    /* Final state */
    transform: translateY(0) scale(1);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: 300;
    cursor: pointer;
    background: none;
    border: none;
    color: #333;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #f00; /* Red hover for close button */
    transform: rotate(90deg);
}

/* --- Modal Content Formatting --- */

.modal-title {
    font-size: 1.8em;
    color: var(--primary-color, #1a237e);
    margin-top: 0;
    margin-bottom: 15px;
}

.modal-meta p {
    margin: 5px 0;
    font-size: 1em;
}

.modal-members {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px dashed #ccc; /* Lighter dashed line */
}

.modal-members h4 {
    color: #555;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.summary-divider {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

.full-summary-text p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #333;
    text-align: justify; /* Justify text for a formal look */
}

.full-summary-text strong {
    font-weight: 700;
    color: #111;
}

/* Cleanup: Ensure this is hidden */
.summary-details {
    display: none;
}

/* --- RESPONSIVENESS (Mobile and Tablet) --- */

@media (max-width: 768px) {
    /* --- Grid & Tile Adjustments --- */
    
    .study-main {
        padding-top: 70px; /* Adjust for common mobile header height */
    }

    .summaries-grid {
        grid-template-columns: 1fr; /* Stack tiles into a single column on phones/tablets */
        gap: 20px;
        padding: 10px;
    }

    .summary-card {
        padding: 20px; /* Increase padding for better touch targets */
    }

    .tile-info p {
        font-size: 1em; /* Ensure text is easily readable */
    }

    .view-summary-btn {
        max-width: 100%; /* Button takes full width of the tile for easy tapping */
        padding: 12px 18px;
        font-size: 1em;
    }

    /* --- Virtual Window (Modal) Adjustments --- */

    .modal-content {
        padding: 20px;
        width: 95%; /* Take up more width on small screens */
        max-width: none; /* Override max-width for better use of mobile screen */
        max-height: 95vh; /* Allow modal to fill most of the screen vertically */
    }

    .modal-title {
        font-size: 1.4em; /* Smaller title size for mobile */
    }

    .full-summary-text p {
        line-height: 1.6;
        text-align: left; /* Justified text can look bad on narrow columns */
    }
}