/* Modern CSS styling for the submission viewer */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #e6fffa 0%, #f0fff4 100%);
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #16a085 0%, #2980b9 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(22, 160, 133, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="1" fill="white" opacity="0.1"/><circle cx="10" cy="90" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.1;
}

header h1 {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

/* Animation styles for split text */
.animated-title {
    overflow: hidden;
}

.loading {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #666;
}

.error {
    background-color: #fee;
    color: #c33;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    border-left: 4px solid #c33;
}

/* Table styles */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #16a085;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

tr:hover {
    background-color: #f0fdfa;
}

tr:last-child td {
    border-bottom: none;
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(135deg, #16a085 0%, #2980b9 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(22, 160, 133, 0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(22, 160, 133, 0.3);
    background: linear-gradient(135deg, #138d75 0%, #2471a3 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    box-shadow: 0 4px 15px rgba(52, 73, 94, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #2c3e50 0%, #273746 100%);
    box-shadow: 0 8px 25px rgba(52, 73, 94, 0.3);
}

.btn-export {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2);
    white-space: nowrap;
    min-width: 140px;
}

.btn-export:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.3);
}

.btn-export:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.2);
}

/* Detail page styles */
.detail-container {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(22, 160, 133, 0.1);
    margin-bottom: 2rem;
    border: 1px solid rgba(22, 160, 133, 0.1);
}

.detail-header {
    border-bottom: 3px solid #e6fffa;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.detail-header h2 {
    color: #16a085;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.detail-header p {
    color: #7dd3c7;
    font-size: 1.1rem;
    font-weight: 500;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-item {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    padding: 1.8rem;
    border-radius: 15px;
    border-left: 5px solid #16a085;
    box-shadow: 0 4px 15px rgba(22, 160, 133, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.detail-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(22, 160, 133, 0.15);
}

.detail-item h3 {
    color: #16a085;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item p {
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
}

/* JSON tables */
.json-section {
    margin-top: 2.5rem;
}

.json-section h3 {
    color: #16a085;
    margin-bottom: 1.5rem;
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e6fffa;
    padding-bottom: 0.5rem;
}

.json-table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(22, 160, 133, 0.1);
    margin-bottom: 2rem;
    border: 1px solid rgba(22, 160, 133, 0.1);
}

.json-table th {
    background: #16a085;
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    padding: 1.2rem 1rem;
}

.json-table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid #e6fffa;
    font-size: 1rem;
    line-height: 1.6;
}

.json-table tr:hover {
    background-color: #f0fff4;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* Search and Export styles */
.search-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-export-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 300px;
}

.search-input {
    width: 100%;
    max-width: 100%;
    padding: 18px 24px;
    border: 3px solid #b8e6d1;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    background: white;
    box-shadow: 0 4px 15px rgba(22, 160, 133, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.search-input:focus {
    outline: none;
    border-color: #16a085;
    box-shadow: 0 8px 25px rgba(22, 160, 133, 0.2);
    transform: translateY(-2px);
}

.search-input::placeholder {
    color: #7dd3c7;
    font-weight: 400;
}

.search-results {
    font-size: 0.9rem;
    color: #16a085;
    font-style: italic;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Table improvements for full width - Override existing styles */
.table-container {
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #eee;
}

/* Specific column widths using percentage for better responsiveness */
th:nth-child(1), td:nth-child(1) { width: 12%; } /* Nama */
th:nth-child(2), td:nth-child(2) { width: 8%; }  /* Kelas */
th:nth-child(3), td:nth-child(3) { width: 12%; } /* Skor */
th:nth-child(4), td:nth-child(4) { width: 12%; } /* Refleksi 1 */
th:nth-child(5), td:nth-child(5) { width: 12%; } /* Refleksi 2 */
th:nth-child(6), td:nth-child(6) { width: 12%; } /* Refleksi 3 */
th:nth-child(7), td:nth-child(7) { width: 12%; } /* Refleksi 4 */
th:nth-child(8), td:nth-child(8) { width: 15%; } /* Target Upgrade */
th:nth-child(9), td:nth-child(9) { width: 8%; }  /* Aksi */

/* Sortable headers */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.sortable:hover {
    background-color: #138d75 !important;
}

.sort-icon {
    margin-left: 5px;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

/* Bold text for nama and kelas */
.bold-text {
    font-weight: 700;
    color: #2d3748;
}

/* Skor cell styling */
.skor-cell {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #16a085;
    font-size: 0.9rem;
}

/* Special styling for target upgrade cell */
.target-upgrade-cell {
    white-space: normal !important;
    word-wrap: break-word;
    max-width: 200px;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* Word wrap styling for refleksi columns */
.refleksi-cell {
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
    max-width: 0; /* Forces word wrap */
    padding: 12px 8px;
    vertical-align: top;
}

/* Alternative styling using nth-child for better compatibility */
td:nth-child(4), /* R1: Level */
td:nth-child(5), /* R2: Kesadaran */
td:nth-child(6), /* R3: Faktor Malas */
td:nth-child(7)  /* R4: Langkah Upgrade */ {
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
    max-width: 0; /* Forces word wrap */
    padding: 12px 8px;
    vertical-align: top;
}

.text-truncate {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

/* Responsive improvements */
@media (max-width: 1400px) {
    .container {
        padding: 15px;
    }
    
    th, td {
        padding: 10px 6px;
        font-size: 0.9rem;
    }
    
    .detail-container {
        padding: 2rem;
    }
    
    .detail-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .search-export-row {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .search-input {
        max-width: 100%;
        min-width: auto;
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .btn-export {
        width: 100%;
        min-width: auto;
    }
    
    th, td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* Mobile optimization for refleksi columns */
    .refleksi-cell {
        font-size: 0.8rem;
        line-height: 1.3;
        padding: 8px 4px;
    }
    
    .detail-container {
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .detail-header h2 {
        font-size: 1.8rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .detail-item {
        padding: 1.5rem;
    }
    
    .json-section h3 {
        font-size: 1.3rem;
    }
    
    .json-table th,
    .json-table td {
        padding: 0.8rem 0.6rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header {
        padding: 2rem 0;
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .detail-container {
        padding: 1rem;
    }
    
    .detail-header h2 {
        font-size: 1.5rem;
    }
    
    .detail-item {
        padding: 1.2rem;
    }
    
    .skor-cell {
        font-size: 0.8rem;
    }
}