/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1d2e;
    color: #e0e0e0;
    overflow: hidden;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1d2e 0%, #2a2d3e 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #252837;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #a8b2d1;
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    color: #8892b0;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #a8b2d1;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    background: #1a1d2e;
    border: 1px solid #3a3d4e;
    border-radius: 6px;
    padding: 12px;
    color: #e0e0e0;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #a8b2d1;
    background: #20232e;
}

.btn-login {
    background: linear-gradient(135deg, #8892b0 0%, #a8b2d1 100%);
    border: none;
    border-radius: 6px;
    padding: 14px;
    color: #1a1d2e;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(168, 178, 209, 0.4);
}

/* Alert messages */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fde68a;
}

/* Dashboard layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #252837;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #3a3d4e;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #3a3d4e;
}

.sidebar-header h2 {
    color: #a8b2d1;
    font-size: 24px;
    margin-bottom: 10px;
}

/* Sottotitolo By Tilog */
.sidebar-subtitle {
    color: #fff;
    font-size: 11px;
    text-align: center;
    margin-top: 5px;
    font-weight: 300;
    letter-spacing: 1px;
    animation: sparkle 3s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                 0 0 20px rgba(255, 255, 255, 0.6),
                 0 0 30px rgba(255, 255, 255, 0.4);
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                     0 0 20px rgba(255, 255, 255, 0.6),
                     0 0 30px rgba(255, 255, 255, 0.4);
    }
    50% {
        opacity: 0.8;
        text-shadow: 0 0 15px rgba(255, 255, 255, 1),
                     0 0 25px rgba(255, 255, 255, 0.8),
                     0 0 35px rgba(255, 255, 255, 0.6);
    }
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #3a3d4e;
}

.user-info span {
    color: #8892b0;
    font-size: 14px;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Sidebar groups */
.sidebar-groups {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.group-item {
    margin-bottom: 5px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #1a1d2e;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.group-header:hover {
    background: #20232e;
}

/* Link Digital Mirror come elemento della sidebar */
.group-link {
    text-decoration: none;
    display: flex;
}

.group-link:hover {
    background: #20232e;
}

.group-toggle {
    color: #a8b2d1;
    font-weight: bold;
    width: 20px;
    text-align: center;
    transition: transform 0.3s;
}

.group-toggle.expanded {
    transform: rotate(45deg);
}

.group-label {
    color: #a8b2d1;
    font-weight: 500;
}

.group-tasks {
    padding-left: 30px;
    margin-top: 5px;
}

.task-item {
    padding: 10px 12px;
    background: #2a2d3e;
    border-radius: 4px;
    margin-bottom: 5px;
    color: #8892b0;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.task-item:hover {
    background: #3a3d4e;
    color: #a8b2d1;
    transform: translateX(5px);
}

.task-item.active {
    background: #a8b2d1;
    color: #1a1d2e;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    background: #1a1d2e;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h1 {
    color: #a8b2d1;
    font-size: 32px;
    margin-bottom: 10px;
}

.welcome-message p {
    color: #8892b0;
    font-size: 16px;
}

/* Parameters form */
#parameters-form {
    background: #252837;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

#parameters-form h2 {
    color: #a8b2d1;
    font-size: 20px;
    margin-bottom: 20px;
}

#query-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#dynamic-parameters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

#dynamic-parameters .form-group input,
#dynamic-parameters .form-group select {
    background: #1a1d2e;
    border: 1px solid #3a3d4e;
    border-radius: 6px;
    padding: 10px;
    color: #e0e0e0;
    font-size: 14px;
}

#dynamic-parameters .form-group input:focus {
    outline: none;
    border-color: #a8b2d1;
}

.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.form-actions label {
    color: #8892b0;
    font-size: 14px;
}

.form-actions select {
    background: #1a1d2e;
    border: 1px solid #3a3d4e;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e0e0e0;
    cursor: pointer;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #8892b0 0%, #a8b2d1 100%);
    color: #1a1d2e;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(168, 178, 209, 0.3);
}

.btn-secondary {
    background: #2a2d3e;
    color: #a8b2d1;
    border: 1px solid #3a3d4e;
}

.btn-secondary:hover {
    background: #3a3d4e;
}

/* Results area */
#results-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Scrollbar orizzontale superiore */
.horizontal-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
    background: #252837;
    border-radius: 8px 8px 0 0;
    border: 1px solid #3a3d4e;
    border-bottom: none;
}

.horizontal-scroll-top-inner {
    height: 1px;
}

.grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    gap: 10px;
    overflow: hidden;
}

.grid-wrapper {
    overflow: auto;
    background: #252837;
    border-radius: 0 0 8px 8px;
    border: 1px solid #3a3d4e;
    border-top: none;
}

/* Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.results-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #2a2d3e;
}

.results-table th {
    padding: 12px;
    text-align: left;
    color: #a8b2d1;
    font-weight: 600;
    border-bottom: 2px solid #3a3d4e;
    white-space: nowrap;
}

.results-table th .column-header {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.results-table th .column-name {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}

.results-table th .sort-icon {
    font-size: 10px;
    color: #8892b0;
}

.results-table th .column-filter {
    width: 100%;
}

.results-table th .column-filter input {
    width: 100%;
    background: #1a1d2e;
    border: 1px solid #3a3d4e;
    border-radius: 4px;
    padding: 6px;
    color: #e0e0e0;
    font-size: 12px;
}

.results-table th .column-filter input:focus {
    outline: none;
    border-color: #a8b2d1;
}

.results-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #3a3d4e;
    color: #e0e0e0;
}

.results-table tbody tr:hover {
    background: #2a2d3e;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #252837;
    border-radius: 8px;
    margin: 10px 0;
}

.pagination-vertical {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #252837;
    border-radius: 8px;
}

.pagination-info {
    color: #8892b0;
    font-size: 14px;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
}

.pagination-btn {
    padding: 8px 12px;
    background: #2a2d3e;
    border: 1px solid #3a3d4e;
    border-radius: 4px;
    color: #a8b2d1;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: #3a3d4e;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #a8b2d1;
    color: #1a1d2e;
}

.pagination-vertical .pagination-btn {
    width: 100%;
    text-align: center;
}

/* Loading spinner */
#loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #3a3d4e;
    border-top-color: #a8b2d1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading p {
    color: #8892b0;
    font-size: 14px;
}

/* Scrollbar personalizzata */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1d2e;
}

::-webkit-scrollbar-thumb {
    background: #3a3d4e;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4d5e;
}
