/* General Body and Container Styles */
body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased; /* Improves font rendering on macOS */
    -moz-osx-font-smoothing: grayscale; /* Improves font rendering on macOS */
}

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

/* Header Styles */
.main-header {
    background-color: #0056b3; /* Darker blue, primary header background */
    color: #fff;
    padding: 20px 0; /* Adjust padding for better visual balance */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex; /* Use Flexbox for aligning elements */
    justify-content: space-between; /* Space out elements to the ends */
    align-items: center; /* Vertically center elements */
    flex-wrap: wrap; /* Allows wrapping on smaller screens for responsiveness */
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    width: 100%; /* Ensure container takes full width within header */
    padding: 0 20px; /* Reapply padding for consistency */
}

.main-header h1 {
    margin: 0;
    font-size: 1.8em;
    letter-spacing: 0.5px;
}

/* Logo container in header */
.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    max-height: 50px; /* Adjust max size for logo */
    width: auto;
}

/* Navigation Styles */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-nav ul li {
    margin-left: 20px;
}

.main-nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav ul li a:hover,
.main-nav ul li a:focus {
    color: #aed6f1; /* Lighter blue on hover */
    text-decoration: underline;
}

/* User Profile Styles */
.user-profile {
    display: flex; /* Use Flexbox for image, info, and buttons */
    align-items: center; /* Vertically center */
    gap: 15px; /* Space between profile elements */
    flex-wrap: wrap; /* Allow profile elements to wrap */
    justify-content: flex-end; /* Align to the right by default on desktop */
    color: #fff; /* Ensure text color is white for consistency with header */
}

.profile-avatar img {
    width: 50px; /* Fixed size for avatar */
    height: 50px;
    border-radius: 50%; /* Make it round */
    object-fit: cover; /* Ensure image covers the area without distortion */
}

.profile-info {
    display: flex;
    flex-direction: column; /* Stack name and email */
}

.user-name {
    font-weight: bold;
    margin: 0;
}

.user-email {
    font-size: 0.9em;
    color: #f0f0f0; /* Slightly lighter white for email */
    margin: 0;
}

.profile-actions {
    display: flex; /* Use Flexbox for buttons */
    gap: 10px; /* Space between buttons */
    flex-wrap: wrap; /* Allow buttons to wrap */
}

.action-button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent button text from breaking */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.action-button:not(.logout) {
    background-color: #007bff; /* Color for "Upload photo" */
    color: white;
}

.action-button.logout {
    background-color: #dc3545; /* Color for "Logout" */
    color: white;
}

.action-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Hamburger menu (for mobile) - Hidden by default on desktop */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: #fff; /* White color for the toggle icon */
}

/* Specific states for open/close buttons (for mobile sidebar) */
.menu-toggle#abrir {
    display: none; /* Hidden by default on desktop, shown by media query */
}

.menu-toggle#cerrar {
    display: none; /* Hidden by default, shown by media query when sidebar is open */
}

/* Content Area */
.content-area {
    padding: 40px 0;
}

.distributivo-list h2 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 30px;
    font-size: 2em;
    position: relative;
    padding-bottom: 10px;
}

.distributivo-list h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: #007bff; /* Accent blue */
    border-radius: 2px;
}

/* Card Grid Layout */
.card-grid {
    display: grid;
    /* Responsive grid: columns will be at least 280px wide and fill available space */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px; /* Spacing between cards */
    padding: 20px 0;
}

.distributivo-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 25px;
    text-align: center;
}

.distributivo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.docente-info {
    margin-bottom: 20px;
}

.docente-photo-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 3px solid #007bff; /* Border around photo */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Prevent container from shrinking */
}

.docente-photo {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the area without distortion */
    display: block;
}

.docente-info h3 {
    margin: 10px 0 5px;
    color: #212529;
    font-size: 1.4em;
    font-weight: 600;
}

.docente-info .docente-id {
    color: #6c757d;
    font-size: 0.9em;
}

.asignaturas-list {
    text-align: left;
    flex-grow: 1; /* Allows this section to take up available space */
    margin-bottom: 15px; /* Space before actions */
}

.asignaturas-list h4 {
    color: #007bff;
    font-size: 1.1em;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.asignaturas-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.asignaturas-list ul li {
    background-color: #e9ecef;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    font-size: 0.95em;
    color: #495057;
    display: flex;
    align-items: center;
}

.asignaturas-list ul li:last-child {
    margin-bottom: 0;
}

/* Action Buttons */
.card-actions {
    margin-top: auto; /* Pushes buttons to the bottom of the card */
    display: flex;
    justify-content: center;
    gap: 10px; /* Space between multiple buttons if you add more */
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 0.95em;
    text-align: center;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.btn.disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #6c757d; /* Keep secondary color for disabled */
    transform: none;
}

/* Footer Styles */
.main-footer {
    background-color: #2c3e50; /* Darker grey/blue */
    color: #ecf0f1;
    padding: 20px 0;
    text-align: center;
    margin-top: 40px;
}

.main-footer p {
    margin: 0;
    font-size: 0.9em;
}

/* Modal Enhancements (assuming Bootstrap modal is used for basic functionality) */
.modal-content {
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background-color: #007bff;
    color: #fff;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: none;
    padding: 15px 20px;
}

.modal-header .close {
    color: #fff;
    opacity: 1;
    font-size: 1.5rem;
    padding: 0;
    margin: -1rem -1rem -1rem auto; /* Adjust close button position */
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* Message Styles (Loading, Info, Error) */
.loading-message,
.info-message,
.error-message {
    text-align: center;
    padding: 20px;
    border-radius: 5px;
    margin-top: 30px;
    font-weight: bold;
}

.loading-message {
    color: #007bff;
    background-color: #e0f2f7;
    border: 1px solid #b3e0ed;
}

.info-message {
    color: #6c757d;
    background-color: #e2e6ea;
    border: 1px solid #d6d8db;
}

.error-message {
    color: #dc3545; /* Red color for errors */
    background-color: #f8d7da; /* Light red background */
    border: 1px solid #f5c6cb;
}

/* Estilos adicionales para el enlace de Drive */
.drive-link {
    display: inline-flex;
    align-items: center;
    color: #28a745; /* Color verde de éxito de Bootstrap */
    text-decoration: none;
    font-weight: bold;
    margin-top: 5px;
    transition: color 0.3s ease;
}
.drive-link:hover {
    color: #218838; /* Tono más oscuro al pasar el ratón */
    text-decoration: underline;
}
.drive-link i {
    margin-right: 5px;
}

/* Estilos para el resumen al final */
.summary-section {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 20px 0;
    margin-top: 30px;
    text-align: center;
}
.summary-section h3 {
    color: #343a40;
    margin-bottom: 15px;
}
.summary-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
.summary-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    min-width: 200px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    text-align: center;
}
.summary-card .count {
    font-size: 2.5rem;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
}
.summary-card .label {
    font-size: 1rem;
    color: #6c757d;
}


/* Responsive Adjustments (from responsive.css, merged and refined) */
@media (max-width: 768px) {
    /* Main Header */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }

    .main-header h1 {
        font-size: 1.5em; /* Example adjustment */
        margin-bottom: 10px;
    }

    .main-header .container {
        flex-direction: column;
        text-align: center;
        padding: 0 10px; /* Adjust container padding for smaller screens */
    }

    .logo-container {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    .logo { /* Overrides general .logo max-height */
        max-height: 35px;
    }

    /* Navigation Menu */
    .main-nav ul {
        flex-direction: column;
        align-items: center;
        width: 100%;
        margin-top: 10px;
    }

    .main-nav ul li {
        margin: 5px 0;
    }

    /* User Profile */
    .user-profile {
        width: 100%;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        margin-top: 15px;
        justify-content: center; /* Ensures elements are centered within the column */
    }

    .profile-avatar img { /* Overrides general profile-avatar img size */
        width: 50px;
        height: 50px;
    }

    .profile-info {
        align-items: center;
    }

    .profile-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
        justify-content: center; /* Center action buttons */
    }

    .action-button {
        width: 100%;
        box-sizing: border-box;
    }

    /* Mobile Menu Toggle Buttons */
    .menu-toggle {
        display: block; /* Show hamburger menu button on smaller screens */
        position: absolute; /* Position relative to header */
        top: 20px;
        right: 20px;
        font-size: 1.5em;
    }

    .menu-toggle#abrir {
        display: block; /* Show open menu button by default */
    }

    .menu-toggle#cerrar {
        display: none; /* Hide close menu button by default */
        z-index: 1001; /* Ensure close button is above sidebar when open */
    }

    /* When sidebar is open */
    body.sidebar-open .menu-toggle#abrir {
        display: none;
    }

    body.sidebar-open .menu-toggle#cerrar {
        display: block;
    }

    /* Public Header (if distinct from main-header) */
    .public-header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .public-nav ul {
        flex-direction: column;
        margin-top: 15px;
        gap: 10px;
    }

    /* Sidebar */
    .sidebar {
        width: 0;
        min-width: 0;
        transform: translateX(-100%);
        padding-top: 50px;
        position: fixed;
        top: 0;
        bottom: 0;
        overflow-y: auto;
        background-color: #f8f8f8;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
    }

    .sidebar.open {
        width: 70%;
        min-width: 200px;
        transform: translateX(0);
    }

    .sidebar .menu-text {
        display: inline;
    }

    .sidebar .menu-icon {
        margin-right: 10px;
    }

    /* Main Content Area */
    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
        transition: margin-left 0.3s ease-in-out;
    }

    /* Adjust main content when sidebar is open (e.g., overlay/dimming) */
    body.sidebar-open .main-content-wrapper {
        overflow: hidden;
    }

    /* General padding adjustments for smaller screens */
    .content-area, .content-wrapper {
        padding: 10px;
        margin: 10px;
    }

    /* Card Grid Layout */
    .card-grid { /* Overrides general card-grid */
        grid-template-columns: 1fr;
    }

    .distributivo-card { /* Overrides general distributivo-card padding */
        padding: 20px;
    }

    .docente-photo-container { /* Overrides general docente-photo-container size */
        width: 100px;
        height: 100px;
    }
}

/* Further adjustments for extra small screens/phones */
@media (max-width: 480px) {
    .container { /* Overrides previous media query container padding */
        padding: 0 15px;
    }

    .logo { /* Overrides previous media query logo max-height */
        max-height: 40px;
    }

    .profile-avatar img { /* Overrides previous media query avatar size */
        width: 40px;
        height: 40px;
    }

    .user-name {
        font-size: 0.95em;
    }

    .user-email {
        font-size: 0.8em;
    }

    /* Header for very small screens */
    .main-header { /* Overrides previous media query header */
        justify-content: center;
        padding: 15px 0; /* Adjust header padding further */
    }

    .main-header .container {
        padding: 0 15px; /* Consistent padding with .container */
    }

    .main-header .logo-container {
        margin-bottom: 10px;
    }

    /* Adjust menu toggle position for very small screens if needed */
    .menu-toggle { /* Overrides previous media query toggle position/size */
        top: 15px;
        right: 15px;
        font-size: 1.3em;
    }

    .distributivo-list h2 { /* Consistent with previous media query */
        font-size: 1.8em;
    }

    .btn { /* Overrides general btn padding/font-size */
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .public-nav ul {
        gap: 5px;
    }

    /* DataTables specific adjustments on small screens */
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-bottom: 10px;
    }
}

/* Additional media query for very large screens */
@media (min-width: 1200px) {
    .main-content-wrapper {
        margin-left: 15%; /* Default margin for sidebar */
        width: 85%; /* Default width for content */
    }
    .sidebar {
        width: 15%; /* Default width for sidebar */
        min-width: 200px;
        position: fixed; /* Ensure it's fixed on larger screens */
        height: 100%; /* Full height */
        top: 0;
        left: 0;
        transform: translateX(0); /* Ensure it's visible */
        box-shadow: none; /* No shadow needed as it's part of layout */
        z-index: 1; /* Lower z-index than modal/header if needed */
        padding-top: 20px; /* Adjust padding if main header is not fixed */
    }
    .menu-toggle {
        display: none; /* Hide menu toggle on large screens */
    }
    body.sidebar-open .main-content-wrapper {
        overflow: auto; /* Allow scrolling */
    }
}
