/* General styles */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #333;
    background-color: #f9f9f9;
}

h1 {
    margin: 0 0 20px;
    color: #454e59;
}

/* Barra superior */
.top-bar {
    height: 60px;
    background-color: #5ccdde;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.top-bar .logo {
    font-size: 24px;
    font-weight: bold;
}

.top-bar .user-menu {
    display: flex;
    align-items: center;
}

/* Contenidor principal */
.main-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* ===============================
   SIDEBAR STYLES 
   =============================== */

/* Sidebar base */
#sidebar {
    width: 250px;
    background-color: #454e59;
    min-height: 100vh;
    transition: width 0.3s ease;
    overflow: hidden;
}

#sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#sidebar ul li {
    margin: 0;
}

#sidebar ul li a {
    display: flex;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    color: #acb5bf;
    border-bottom: 1px solid #2c3e50;
    transition: background-color 0.3s ease;
}

#sidebar ul li a:hover {
    background-color: #2c3e50;
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* USUARIS: sidebar col·lapsada = completament amagada */
#sidebar.collapsed:not(.admin-sidebar) {
    width: 0 !important;
    overflow: hidden;
    padding: 0 !important;
    min-width: 0 !important;
    border: none !important;
}

/* ADMINS: sidebar col·lapsada = mostra només icones (60px) */
#sidebar.collapsed.admin-sidebar {
    width: 60px;
    overflow: hidden;
}

#sidebar.collapsed.admin-sidebar ul li a {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
}

#sidebar.collapsed.admin-sidebar ul li a span {
    display: none !important;
    width: 0;
    overflow: hidden;
}

#sidebar.collapsed.admin-sidebar ul li a i {
    margin-right: 0 !important;
    display: inline-block !important;
    width: 20px;
    text-align: center;
    font-size: 18px;
}

/* ===============================
   END SIDEBAR STYLES 
   =============================== */

/* Contingut principal */
.content {
    flex-grow: 1;
    padding: 20px;
    background-color: #ffffff;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    transition: margin-left 0.3s ease;
    margin-left: 0; /* Dynamic: changes based on sidebar state */
}

/* Taula agGrid */

#myGrid {
    /* NO height - let AG Grid autoHeight work */
    width: 100%;
    margin: 20px 0;
}

.ag-header-cell-menu-button::before {
    content: "🔍";
    font-size: 14px;
}
.ag-header-cell-menu-button > span {
    display: none; /* amaga l’original */
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
}

.logo {
    width: 100px;
    margin-bottom: 20px;
}

.login-form {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 5%;
    width: 90%;
    max-width: 200px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.login-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.login-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.login-form button {
    width: 100%;
    padding: 10px;
    background-color: #5ccdde;
    border-color: #5ccdde;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-form button:hover {
    background-color: #457fa0;
}

.submit-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}


.submit-line button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #5ccdde;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-line button:hover {
    background-color: #457fa0;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.login-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1; /* Fa que estigui darrere del contingut */
    opacity: 1; /* pots ajustar-ho si vols més foscor */
}

/* Animació suau */
@keyframes pulseSlow {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.10);
        filter: brightness(1.05);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.animation-pulseSlow {
    animation-name: pulseSlow;
    animation-duration: 30s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.form-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 20px;
    max-width: 320px;   /* més petit */
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    font-size: 14px;    /* lleugerament més petit */
}

.form-container div {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.form-container label {
    font-weight: 600;
    flex-grow: 1;
}

.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="text"],
.form-container select {
    flex-grow: 1;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 8px;
}

.form-container input[type="checkbox"] {
    margin-left: 8px;
    margin-right: 0;
    /* sense centrar, estarà a la dreta */
}

.form-container div:last-child {
    justify-content: center;
    margin-top: 16px;
}

.form-container button {
    width: 100%;
    padding: 10px;
    background-color: #5ccdde;
    border: none;
    color: white;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s;
}

.form-container button:hover {
    background-color: #457fa0;
}

#myGrid.ag-theme-alpine .ag-row {
    font-size: 12px;
  }

#productesGrid.ag-theme-alpine .ag-row {
    font-size: 12px;
}

/* Estils per tablets - gestionat per JS i classes collapsed/admin-sidebar */

/* Estils per mòbils */
@media (max-width: 768px) {

    .main-container {
        flex-direction: row; /* Keep horizontal layout so sidebar pushes content */
    }

    .content {
        padding: 16px;
        box-shadow: none;
        flex-grow: 1; /* Take remaining space */
    }

    h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .grid-container {
        margin-bottom: 2rem;
        overflow-x: auto; /* Permet scroll horitzontal només aquí */
        -webkit-overflow-scrolling: touch; /* Scroll suau en mòbils */
    }

    #myGrid,
    #productesGrid {
        width: 100%;
        overflow-x: auto;
    }

    .ag-theme-alpine {
        min-width: 600px; /* fa que el grid sigui scrollable si cal */
    }

    #total-preu {
        text-align: center;
        font-size: 1.2rem;
    }

    .login-form {
        width: 90%;
        max-width: 280px;
        padding: 10%;
    }

    .login-form input,
    .login-form button {
        font-size: 16px;
    }

    .submit-line {
        flex-direction: column;
        align-items: stretch;
    }

    .submit-line button {
        width: 100%;
        font-size: 16px;
    }
}

