/*------------------------------------*\
    Nginxy - Modernized Version
    by @lfelipe1501

    Theme name: Nginxy
    Theme author: @lfelipe1501
\*------------------------------------*/
/*@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap");
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');*/

/* Light Theme Variables (default) */
:root {
    color-scheme: light dark;
    --primary-color: #6d8eff;
    --secondary-color: #adb5bd;
    --hover-color: #dc8867;
    --background-color: #282523;
    --text-color: #e0e0e0;
    --border-color: #2d2d2d;
    --header-color: #e0e0e0;
    --footer-color: #4e423b0a;
    --table-header-bg: #2d2d2d;
    --table-header-color: #e0e0e0;
    --table-shadow: rgba(0, 0, 0, 0.2);
    --icon-opacity: 0.9;
}

/* Dark Theme Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #6d8eff;
        --secondary-color: #adb5bd;
        --hover-color: #dc8867;
        --background-color: #282523;
        --text-color: #e0e0e0;
        --border-color: #2d2d2d;
        --header-color: #e0e0e0;
        --footer-color: #4e423b0a;
        --table-header-bg: #2d2d2d;
        --table-header-color: #e0e0e0;
        --table-shadow: rgba(0, 0, 0, 0.2);
        --icon-opacity: 0.9;
    }
}

/* Keep classes for manual theme change */
.light-theme {
    --primary-color: #4a6cf7;
    --secondary-color: #6c757d;
    --hover-color: #dc8867;
    --background-color: #ffffff;
    --text-color: #333333;
    --border-color: #e9ecef;
    --header-color: #343a40;
    --footer-color: #f8f9fa;
    --icon-size: 24px;
    --table-header-bg: #4a6cf7;
    --table-header-color: #ffffff;
    --table-shadow: rgba(8, 6, 6, 0.05);
    --icon-opacity: 1;
}

.dark-theme {
    --primary-color: #6d8eff;
    --secondary-color: #adb5bd;
    --hover-color: #dc8867;
    --background-color: #282523;
    --text-color: #e0e0e0;
    --border-color: #2d2d2d;
    --header-color: #e0e0e0;
    --footer-color: #4e423b0a;
    --table-header-bg: #2d2d2d;
    --table-header-color: #e0e0e0;
    --table-shadow: rgba(0, 0, 0, 0.2);
    --icon-opacity: 0.9;
}

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

html {
    font-size: 16px;
    font-family: "Poppins", 'Andada Pro', 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

body {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    background: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-color);
    opacity: 0.8;
}

/* Icon styles */
.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.icon-container svg {
    width: var(--icon-size);
    height: var(--icon-size);
    opacity: var(--icon-opacity);
    transition: opacity 0.3s ease;
}

.colored-icon {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.dark-theme .colored-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) brightness(1.1);
}

.icon-text-container {
    display: flex;
    align-items: center;
}

/*------------------------------------*\
    Header
\*------------------------------------*/
h1 {
    font-weight: 500;
    text-align: center;
    font-size: 1.8rem;
    padding: 1.5rem 0;
    color: var(--header-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

h1::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23ffc107" d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

.dark-theme h1::before {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23ffc107" d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>');
}

/*------------------------------------*\
    Table (directory listing)
\*------------------------------------*/
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px var(--table-shadow);
    border-radius: 5px;
    overflow: hidden;
}

th {
    background-color: var(--table-header-bg);
    color: var(--table-header-color);
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    position: relative;
}

th[data-sort] {
    position: relative;
    padding-right: 25px; /* Espacio para el icono de ordenamiento */
    user-select: none; /* Evitar selección de texto */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

th[data-sort]::after {
    content: "⇕";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 0.8rem;
}

th[data-sort]:hover {
    background-color: var(--hover-color);
}

th[data-sort]:hover::after {
    opacity: 1;
}

/* Estilos para los iconos de ordenamiento */
.sort-icon {
    display: inline-block;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    line-height: 1;
    opacity: 1;
    transition: all 0.2s ease;
}

/* 1st Column: Filename */
th:first-child {
    width: 60%;
}

/* 2nd Column: Last Modified */
th:nth-child(2) {
    width: 25%;
}

/* 3rd Column: Size */
th:nth-child(3) {
    width: 15%;
    text-align: right;
}

tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

tr:hover {
    background-color: var(--hover-color);
}

tr:hover .colored-icon {
    opacity: 1;
    transform: scale(1.05);
}

td {
    padding: 0.75rem;
    vertical-align: middle;
}

td:last-child {
    text-align: right;
}

td a {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

td a:hover {
    color: var(--primary-color);
}

tr.parent a {
    color: var(--secondary-color);
}

/*------------------------------------*\
    Footer
\*------------------------------------*/
#footer {
    padding: 1rem 0;
    text-align: center;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    background-color: var(--footer-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

#footer .text-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.footer-logo {
    margin-top: 0.5rem;
    transition: filter 0.3s ease;
    display: block;
    margin: 10px auto;
}

/*------------------------------------*\
    Responsive Styles
\*------------------------------------*/
/* Mobile View */
.mobile-view table {
    overflow-x: auto;
}

.mobile-view th:nth-child(2),
.mobile-view td:nth-child(2) {
    display: none;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
        padding: 1rem 0;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    th:nth-child(2),
    td:nth-child(2) {
        display: none;
    }
    
    .icon-container svg {
        --icon-size: 20px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    body {
        padding: 0 0.5rem;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .icon-container svg {
        --icon-size: 18px;
    }
}

/* Botón para cambiar tema */
.theme-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
}

/* Ajustar para pantallas pequeñas */
@media (max-width: 768px) {
    .theme-toggle-btn {
        bottom: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/*------------------------------------*\
    Paginación y Ordenamiento
\*------------------------------------*/
#pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.pagination-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 2.5rem;
    text-align: center;
}

.pagination-btn-number {
    background-color: var(--secondary-color);
}

.pagination-btn-active {
    background-color: var(--hover-color);
    font-weight: bold;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    background-color: var(--secondary-color);
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-color);
    padding: 0 0.5rem;
    margin-left: 0.5rem;
}

/* Estilos responsivos para paginación */
@media (max-width: 768px) {
    #pagination-container {
        margin: 0.8rem 0;
        gap: 0.2rem;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
        min-width: 2.2rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    #pagination-container {
        margin: 0.6rem 0;
        gap: 0.1rem;
    }
    
    .pagination-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        min-width: 2rem;
    }
    
    .pagination-info {
        font-size: 0.7rem;
    }
}
