/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&family=Nunito+Sans:wght@400;700&display=swap');

/* Global Styles & Variables */
:root {
    --bg-color: #FAF3E0;
    /* Warm White/Light Beige */
    --primary-color: #6082B6;
    /* Glaucous Blue */
    --highlight-color: #E9C46A;
    /* Golden Yellow */
    --inactive-tab-bg: #EAEAEA;
    --text-color: #4F4F4F;
    /* Dark Gray */
    --light-text-color: #FFFFFF;
    --border-color: #DDDDDD;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Nunito Sans', sans-serif;
}

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Authentication Container */
#authContainer {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: var(--light-text-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    text-align: center;
}

#authContainer h2 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 25px;
}

#authContainer input[type="password"] {
    width: calc(100% - 22px);
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
}

#authContainer button {
    background-color: var(--primary-color);
    color: var(--light-text-color);
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

#authContainer button:hover {
    background-color: #4a6a9a;
    /* Darker shade of primary */
}

#authContainer .message {
    color: #d9534f;
    /* Red for error messages */
    margin-top: 15px;
    min-height: 1.2em;
}

/* Main Site Content */
header {
    background-color: var(--primary-color);
    color: var(--light-text-color);
    padding: 1.5em 0;
    text-align: center;
    box-shadow: 0 2px 5px var(--shadow-color);
}

header h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.2em;
}

/* Tabs Navigation */
#tabsContainer {
    text-align: center;
    padding: 25px 20px 15px;
    /* More vertical space */
    background-color: var(--bg-color);
    /* Match body background */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.tab-button {
    background-color: var(--inactive-tab-bg);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    margin: 0 8px 10px;
    /* Space between and below tabs */
    border-radius: 20px;
    /* Rounded pill shape */
    cursor: pointer;
    font-size: 1em;
    font-family: var(--font-body);
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: var(--highlight-color);
    color: var(--light-text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.tab-button.active {
    background-color: var(--primary-color);
    color: var(--light-text-color);
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

main {
    padding: 20px 30px;
    /* More horizontal padding */
    max-width: 1300px;
    margin: 0 auto;
}

/* Video Gallery */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    /* Slightly larger min size */
    gap: 30px;
    /* Increased gap */
    list-style: none;
    padding: 0;
    margin: 0;
}

.video-item {
    background-color: var(--light-text-color);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    /* More rounded corners */
    box-shadow: 0 4px 8px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    /* Ensure image corners are rounded */
}

.video-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.video-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 5px;
    /* Rounded corners for image */
    margin-bottom: 15px;
    display: block;
}

.video-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em;
    font-family: var(--font-heading);
    color: var(--primary-color);
}

/* Modal Player */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 5% auto;
    padding: 30px;
    border: none;
    border-radius: 10px;
    width: 85%;
    max-width: 900px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.close-button {
    color: var(--text-color);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 35px;
    font-weight: bold;
    line-height: 1;
    opacity: 0.7;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    opacity: 1;
}

#modalVideo {
    width: 100%;
    height: auto;
    margin-bottom: 15px;
    border-radius: 5px;
}

#modalVideoTitle {
    font-family: var(--font-heading);
    font-size: 1.6em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

#modalVideoDescription {
    font-family: var(--font-body);
    font-size: 1em;
    color: var(--text-color);
    line-height: 1.5;
}

footer {
    text-align: center;
    padding: 25px 20px;
    background-color: var(--primary-color);
    color: var(--light-text-color);
    margin-top: 40px;
    font-size: 0.9em;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .video-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }

    .modal-content {
        width: 90%;
        padding: 20px;
    }

    #modalVideoTitle {
        font-size: 1.4em;
    }

    .tab-button {
        padding: 8px 15px;
        margin: 0 5px 8px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 0;
        /* Remove padding if header is fixed */
    }

    header h1 {
        font-size: 1.5em;
    }

    #tabsContainer {
        padding: 15px 10px 10px;
    }

    .tab-button {
        padding: 7px 12px;
        margin: 0 4px 6px;
        font-size: 0.85em;
    }

    .video-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    main {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }

    #modalVideoTitle {
        font-size: 1.2em;
    }

    #modalVideoDescription {
        font-size: 0.9em;
    }
}

/* Estilos para a aba de gerenciamento de vídeos */
.video-filter-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group,
.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group select,
.search-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

.video-list-container {
    max-height: 500px;
    overflow-y: auto;
}

#videoTable {
    width: 100%;
    border-collapse: collapse;
}

#videoTable th,
#videoTable td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#videoTable th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
}

.video-thumbnail {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.video-actions {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.change-group-container {
    display: flex;
    gap: 5px;
}

.change-group-container select {
    flex-grow: 1;
}

/* Estilos para o modal de permissões */
.permissions-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.permissions-header {
    position: fixed;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.permissions-search {
    margin-bottom: 20px;
}

.permissions-search input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.permissions-users-container {
    margin-bottom: 20px;
}

.permissions-user-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    background-color: #f9f9f9;
}

.permissions-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.permissions-user-item:last-child {
    border-bottom: none;
}

.permissions-add-form {
    display: flex;
    gap: 10px;
}

.permissions-add-form select {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.remove-permission-btn {
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.remove-permission-btn:hover {
    background-color: #e60000;
}

.manage-permissions-btn {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
}

.manage-permissions-btn:hover {
    background-color: #2b6ed9;
}

.save-group-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
}

.save-group-btn:hover {
    background-color: #3e8e41;
}

.loading-message,
.empty-message,
.error-message {
    padding: 10px;
    text-align: center;
    color: #666;
}

.error-message {
    color: #e60000;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    margin-bottom: 2px;
}

.user-info span {
    font-size: 12px;
    color: #666;
}

/* Centralizar o container de autenticação */
#authContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

/* Estilo do botão Google já centralizado */
.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 4px;
    background-color: white;
    color: #444;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 15px auto;
    /* Isso ajuda na centralização */
    width: fit-content;
    /* Faz o botão ter a largura do conteúdo */
}

/* Tamanho do logo */
.google-logo {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    vertical-align: middle;
}

/* Estilos para a aba de gerenciamento de vídeos */
.video-filter-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group,
.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group select,
.search-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

.video-list-container {
    max-height: 500px;
    overflow-y: auto;
}

#videoTable {
    width: 100%;
    border-collapse: collapse;
}

#videoTable th,
#videoTable td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#videoTable th {
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
}

.video-thumbnail {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.video-actions {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.change-group-container {
    display: flex;
    gap: 5px;
}

.change-group-container select {
    flex-grow: 1;
}

/* Estilos para o modal de permissões
.permissions-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.permissions-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.permissions-search {
    margin-bottom: 20px;
}

.permissions-search input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.permissions-users-container {
    margin-bottom: 20px;
}

.permissions-user-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    background-color: #f9f9f9;
}

.permissions-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.permissions-user-item:last-child {
    border-bottom: none;
}

.permissions-add-form {
    display: flex;
    gap: 10px;
}

.permissions-add-form select {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.remove-permission-btn {
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.remove-permission-btn:hover {
    background-color: #e60000;
}

.manage-permissions-btn {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
}

.manage-permissions-btn:hover {
    background-color: #2b6ed9;
}

.save-group-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
}

.save-group-btn:hover {
    background-color: #3e8e41;
}

.loading-message,
.empty-message,
.error-message {
    padding: 10px;
    text-align: center;
    color: #666;
}

.error-message {
    color: #e60000;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    margin-bottom: 2px;
}

.user-info span {
    font-size: 12px;
    color: #666;
} */