/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-red: #1166a3;
    /* New Primary Blue */
    --primary-blue: #0d4d7a;
    /* Darker shade for interactions */
    --accent-lime: #c0f862;
    /* New Accent */
    --text-dark: #333;
    --text-light: #fff;
    --bg-light: #f5f5f5;
    --border-color: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--primary-red);
    color: var(--text-light);
    padding: 0;
}

.main-header {
    background-color: var(--primary-red);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* Header Content */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px 30px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-menu {
    background-color: var(--primary-blue);
    color: white;
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nav-menu a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
}

/* Container */
.container {
    width: 100%;
    max-width: 1350px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a,
.sidebar-btn {
    display: block;
    background-color: var(--primary-blue);
    color: white;
    padding: 12px 15px;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    transition: background 0.3s;
    width: 100%;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.sidebar-menu a:hover,
.sidebar-btn:hover {
    background-color: #1a237e;
}

.sidebar-menu a.active,
.sidebar-btn.active {
    background-color: var(--primary-red);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    background: white;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    /* Ensure it takes full width when flex direction changes */
}

h2.section-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #222;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Row Grids */
.row-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.row-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.row-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.row-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media screen and (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-danger {
    background-color: var(--primary-red);
    color: white;
}

.btn-success {
    background-color: #2e7d32;
    color: white;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.action-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f9f9f9;
    font-weight: 600;
}

/* Profile Card */
.profile-card {
    display: flex;
    gap: 30px;
    border: 1px solid #eee;
    padding: 20px;
}

.profile-img-container {
    width: 150px;
    height: 180px;
    border: 3px solid var(--accent-lime);
    /* Lime border */
    padding: 3px;
    flex-shrink: 0;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info table {
    width: 100%;
}

.profile-info td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.profile-info td:first-child {
    font-weight: 500;
    width: 150px;
    color: #555;
}

/* Tabs implementation for Single Page Feel */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-blue);
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}


/* Admin Dashboard Cards */
.faculty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.faculty-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.faculty-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-blue);
    cursor: pointer;
}

.faculty-card .card-body {
    padding: 20px;
}

.faculty-card h3 {
    margin-bottom: 5px;
    color: var(--primary-blue);
    font-size: 18px;
}

.faculty-card p.designation {
    color: #666;
    font-weight: 500;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.faculty-card .info-row {
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

.card-header-stripe {
    height: 6px;
    background: var(--primary-blue);
    width: 100%;
}

.faculty-card .card-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.faculty-card:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

.btn-icon-view,
.btn-icon-edit,
.btn-icon-delete {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn-icon-view {
    background: #4caf50;
    /* Green for view */
    color: white !important;
}

.btn-icon-view:hover {
    background: #388e3c;
    transform: scale(1.1);
}

.btn-icon-edit {
    background: #0d4d7a;
    color: white !important;
}

.btn-icon-edit:hover {
    background: #0a3d61;
    transform: scale(1.1);
}

.btn-icon-delete {
    background: #fff;
    color: #cc0000 !important;
    border: 1px solid #ffcccc;
}

.btn-icon-delete:hover {
    background: #cc0000;
    color: white !important;
    transform: scale(1.1);
}

/* Department Grid Styles */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.dept-card {
    background: white;
    text-align: center;
    border: none;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 30px 20px;
    flex-grow: 1;
}

.dept-icon {
    font-size: 32px;
    color: var(--primary-blue);
    margin-bottom: 12px;
    background: #f0f7ff;
    width: 65px;
    height: 65px;
    line-height: 65px;
    border-radius: 50%;
}

.dept-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.dept-count {
    color: #777;
    margin-top: 5px;
    font-size: 14px;
}

/* Department Card Layout Updates */
.dept-card-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.dept-card-wrapper:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-blue);
}

.dept-card-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.dept-card-wrapper:hover .dept-card-actions {
    opacity: 1;
    transform: translateY(0);
}

.btn-icon-view,
.btn-icon-edit,
.btn-icon-delete {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-icon-edit {
    background: #0d4d7a;
    color: white !important;
}

.btn-icon-edit:hover {
    background: #0a3d61;
    transform: scale(1.1);
}

.btn-icon-view {
    background: #007bff;
    color: white !important;
}

.btn-icon-view:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.btn-icon-delete {
    background: #fff;
    color: #cc0000 !important;
    border: 1px solid #ffcccc;
}

.btn-icon-delete:hover {
    background: #cc0000;
    color: white !important;
    transform: scale(1.1);
}

/* Ensure departmental cards show pointer */
.dept-card {
    cursor: pointer !important;
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-blue);
    font-weight: 500;
    margin-bottom: 20px;
    padding: 8px 15px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
    background: #f8f9fa;
}

/* Footer Styles */
footer {
    background-color: var(--primary-red);
    color: white;
    text-align: center;
    padding: 15px 0;
    margin-top: 40px;
    font-size: 14px;
    width: 100%;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    padding: 35px;
    border-radius: 16px;
    width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* RESPONSIVE MEDIA QUERIES */
@media screen and (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 0 15px;
        margin-top: 20px;
    }

    .main-content {
        order: 1;
        width: 100%;
    }

    .sidebar {
        order: 2;
        width: 100%;
        margin-top: 30px;
        margin-bottom: 20px;
    }

    /* Make sidebar menu horizontal scrollable on mobile for better UX */
    /* Sidebar menu vertical stack on mobile */
    .sidebar-menu {
        display: flex;
        flex-direction: column;
        gap: 10px;
        overflow-x: visible;
        padding-bottom: 0;
        white-space: normal;
    }

    .sidebar-menu a,
    .sidebar-btn {
        width: 100%;
        padding: 12px 15px;
        display: block;
        text-align: center;
    }

    .main-content {
        padding: 20px;
    }

    /* Collapse grids to single column */
    .row-grid-2,
    .row-grid-3,
    .row-grid-4,
    .row-grid-5 {
        grid-template-columns: 1fr;
    }

    /* Make tables scrollable */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .logo img {
        margin-bottom: 10px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .profile-card {
        flex-direction: column;
        align-items: center;
    }

    .profile-img-container {
        margin-bottom: 20px;
    }
}