@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body { 
    font-family: 'Inter', sans-serif; 
    background-color: #eef1f5; 
    margin: 0; 
    padding: 20px; 
    color: #334155;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}
.container { 
    width: 100%;
    max-width: 450px; 
    background: #ffffff; 
    padding: 40px 35px; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    box-sizing: border-box;
}
.container-large { 
    width: 100%;
    max-width: 1100px; 
    background: #ffffff; 
    padding: 40px 35px; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    box-sizing: border-box;
    margin: 20px;
}
.table-responsive { overflow: auto; margin-top: 20px; max-width: 100%; max-height: calc(100vh - 180px); border-radius: 8px; border: 1px solid #e2e8f0; }
table { width: 100%; border-collapse: collapse; min-width: max-content; margin: 0; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; text-align: left; font-size: 13px; white-space: nowrap; }
th { background-color: #f8fafc; font-weight: 600; color: #475569; position: sticky; top: 0; z-index: 10; border-top: none; }
td img { max-width: 50px; border-radius: 4px; display: block; }
.logo-container {
    text-align: center;
    margin-bottom: 30px;
}
.logo-container img {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}
.logo-container h1 {
    font-size: 22px;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
}
.logo-container p {
    font-size: 14px;
    color: #64748b;
    margin: 5px 0 0 0;
}

h2 { 
    color: #1e293b; 
    margin-top: 0; 
    text-align: center;
    font-size: 18px;
    margin-bottom: 25px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}
.form-group { 
    margin-bottom: 20px; 
}
label { 
    display: block; 
    margin-bottom: 8px; 
    color: #475569; 
    font-weight: 600;
    font-size: 14px;
}
input[type="text"], input[type="password"], input[type="file"], input[type="email"], input[type="tel"], select { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    box-sizing: border-box; 
    background-color: #ffffff;
    color: #334155;
    font-size: 15px;
    transition: all 0.2s;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="tel"]:focus, select:focus {
    outline: none;
    border-color: #5482d8;
    box-shadow: 0 0 0 3px rgba(84, 130, 216, 0.1);
}
button { 
    background-color: #5482d8;
    color: white; 
    border: none; 
    padding: 14px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 16px; 
    width: 100%; 
    font-weight: 600;
    transition: background-color 0.2s;
    margin-top: 10px;
}
button:hover { 
    background-color: #4068b5; 
}
.info { 
    background: #f8fafc; 
    padding: 15px; 
    border-radius: 8px; 
    font-size: 13px; 
    color: #64748b; 
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    line-height: 1.5;
}

/* Specific to index.php */
ul { list-style-type: none; padding: 0; margin-top: 20px; }
li { background: #ffffff; margin-bottom: 10px; padding: 15px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #e2e8f0; transition: border-color 0.2s;}
li:hover { border-color: #5482d8; }
li a { text-decoration: none; color: #1e293b; font-weight: 600; flex-grow: 1; }
li a:hover { color: #5482d8; }
.locked { color: #ef4444; font-size: 13px; font-weight: 600; background: #fee2e2; padding: 4px 8px; border-radius: 4px;}

/* Specific to student.php */
.camera-group { background: #f8fafc; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e2e8f0; border-left: 4px solid #5482d8;}
.camera-group label { color: #1e293b; font-weight: 600; }
.camera-group input[type="file"] { 
    background: #ffffff; 
    border: 1px dashed #cbd5e1; 
    cursor: pointer; 
    padding: 15px;
    color: transparent;
}
.camera-group input[type="file"]::-webkit-file-upload-button {
    visibility: hidden;
    width: 0;
}
.camera-group input[type="file"]::before {
    content: '📸 Click Picture';
    color: #fff;
    display: inline-block;
    background: #5482d8;
    border-radius: 6px;
    padding: 10px 18px;
    outline: none;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-right: 15px;
    font-family: 'Inter', sans-serif;
}
.camera-group input[type="file"]:hover::before {
    background: #4068b5;
}
.preview { max-width: 100px; margin-top: 10px; display: none; border-radius: 6px; border: 1px solid #cbd5e1; }

/* Dashboard Layout */
body.dashboard-layout {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    margin: 0;
    height: 100vh;
    background-color: #f8fafc;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
}

.header-text h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
}

.header-text span {
    font-size: 12px;
    color: #64748b;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}

.sidebar-menu {
    list-style: none !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    flex-grow: 1;
}

.sidebar-menu li {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    display: block !important;
}

.sidebar-menu a {
    display: flex !important;
    align-items: center !important;
    padding: 12px 20px !important;
    color: #475569 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 15px !important;
    border-left: 3px solid transparent !important;
}

.sidebar-menu li.active a {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border-left-color: #3b82f6 !important;
    font-weight: 600 !important;
}

.sidebar-menu a:hover {
    background-color: #f8fafc !important;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-info .avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #334155;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
    font-size: 18px;
}

.user-details h4 {
    margin: 0;
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
}

.user-details span {
    font-size: 13px;
    color: #64748b;
}

.logout-link {
    display: block;
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-top: 10px;
}

.logout-link:hover {
    text-decoration: underline;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f8fafc;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 25px;
    max-width: 600px;
    margin-bottom: 20px;
}

.card-wide {
    max-width: 100%;
}

@media print {
    body { background: #fff; padding: 0; margin: 0; }
    .sidebar { display: none !important; }
    .main-content { padding: 0 !important; overflow: visible !important; }
    .card { box-shadow: none !important; padding: 0 !important; margin: 0 !important; border: none !important; }
    form, button, .no-print { display: none !important; }
    .table-responsive { max-height: none !important; overflow: visible !important; border: none !important; margin-top: 10px !important; }
    table { width: 100% !important; border-collapse: collapse !important; }
    th, td { padding: 6px !important; font-size: 11px !important; border: 1px solid #000 !important; white-space: normal !important; word-wrap: break-word !important; }
    th { background-color: #f1f5f9 !important; color: #000 !important; position: static !important; }
    h2 { font-size: 18px !important; margin-bottom: 10px !important; }
    /* Hide specific columns for a cleaner PDF: Photos and Actions */
    th:nth-child(8), td:nth-child(8), /* Student Photo */
    th:nth-child(9), td:nth-child(9), /* Father Photo */
    th:nth-child(10), td:nth-child(10), /* Mother Photo */
    th:nth-child(11), td:nth-child(11), /* Guardian Photo */
    th:last-child, td:last-child /* Actions */ {
        display: none !important;
    }
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}
.mobile-header .menu-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #1e293b;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: auto;
}

@media (max-width: 1024px) {
    body.dashboard-layout {
        flex-direction: column;
        overflow-y: auto;
    }
    .mobile-header {
        display: flex;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-shrink: 0;
        display: none; /* hidden by default */
    }
    .sidebar.show-sidebar {
        display: flex;
        flex-direction: column;
    }
    .sidebar-header {
        display: none; /* hide the original logo in mobile view since it's in mobile-header */
    }
    .sidebar-menu {
        display: flex;
        flex-direction: column;
        padding: 0 !important;
    }
    .sidebar-menu li {
        flex: none;
    }
    .sidebar-menu a {
        padding: 15px 20px !important;
        font-size: 15px !important;
        border-left: 3px solid transparent !important;
        border-bottom: none;
    }
    .sidebar-menu li.active a {
        border-left-color: #3b82f6 !important;
        border-bottom-color: transparent !important;
    }
    .main-content {
        padding: 15px;
        overflow-y: visible;
    }
    .card {
        padding: 15px;
    }
    .table-responsive {
        max-height: none; /* Let table scroll inside page on mobile */
    }
    .card-wide form {
        flex-direction: column;
        align-items: stretch !important;
    }
    .card-wide form > * {
        width: 100% !important;
        margin-bottom: 5px;
    }
    .card-wide form button {
        margin-top: 5px !important;
    }
}
