/**
 * Stili generali - Pagina Login
 */

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #eee;
}

.login-container {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-container h1 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
}

/* Password con toggle mostra/nascondi */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 5.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
}

.password-toggle:hover {
    color: #ff6b8a;
}

.password-toggle .icon-hide {
    display: none;
}

.password-toggle.visible .icon-show {
    display: none;
}

.password-toggle.visible .icon-hide {
    display: inline;
}

.login-form input:focus {
    outline: none;
    border-color: #e94560;
    background: rgba(255, 255, 255, 0.08);
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.btn-login {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.5rem;
    border: none;
    border-radius: 8px;
    background: #e94560;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #c73e54;
}

.error-message {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid rgba(233, 69, 96, 0.5);
    color: #ff6b6b;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ========== Layout Pannello di controllo ========== */

.panel-body {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: #0f1419;
    color: #e6edf3;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    height: 100%;
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #30363d;
}

.sidebar-logo {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e6edf3;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 0.65rem 1rem;
    color: #8b949e;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s, background 0.2s;
}

.sidebar-menu a:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu a.active {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
    border-left: 3px solid #e94560;
    padding-left: calc(1rem - 3px);
}

.sidebar-menu-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #30363d;
}

.panel-main {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel-content {
    padding: 1.5rem 2rem;
}

.panel-content h1 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0;
}

.page-header .btn-add-landing {
    flex-shrink: 0;
}

/* Form nel pannello */
.panel-form {
    max-width: 400px;
    margin-top: 1rem;
}

.panel-form .form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.panel-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.panel-form .password-wrapper {
    display: block;
    width: 100%;
}

.panel-form .password-wrapper input {
    display: block;
    width: 100%;
    padding: 0.75rem 6rem 0.75rem 1rem;
    box-sizing: border-box;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    color: #e6edf3;
    font-size: 1rem;
}

.panel-form .password-toggle {
    min-width: 5.5rem;
    text-align: right;
}

.panel-form input:focus {
    outline: none;
    border-color: #e94560;
}

.panel-form .btn-login {
    width: auto;
    padding: 0.75rem 1.5rem;
    margin-top: 0.5rem;
}

.success-message {
    background: rgba(46, 160, 67, 0.2);
    border: 1px solid rgba(46, 160, 67, 0.5);
    color: #3fb950;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.btn-add-landing {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-add-landing:hover {
    background: #c73e54;
}

.code-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.landing-code {
    font-family: monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.btn-copy-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #8b949e;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.btn-copy-code:hover {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
    border-color: rgba(233, 69, 96, 0.3);
}

.btn-copy-code:active {
    transform: scale(0.95);
}

.btn-copy-code.copied {
    color: #3fb950;
}

/* Tabella dati */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #30363d;
}

.data-table th {
    background: #161b22;
    color: #8b949e;
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tbody td {
    color: #e6edf3;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
}

.status-badge.status-active {
    background: rgba(46, 160, 67, 0.2);
    color: #3fb950;
}

.status-badge.status-offline {
    background: rgba(139, 148, 158, 0.2);
    color: #8b949e;
}

.status-badge.status-expired {
    background: rgba(248, 81, 73, 0.25);
    color: #f85149;
}

.data-table tbody tr.row-expired {
    background: rgba(248, 81, 73, 0.08);
}

.data-table tbody tr.row-expired:hover {
    background: rgba(248, 81, 73, 0.12);
}

.data-table .cell-expired {
    color: #f85149;
    font-weight: 600;
}

/* Celle azioni - allineamento colonne Rinnova/Modifica */
.actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.data-table th:last-child,
.data-table td:last-child {
    text-align: right;
}

.actions-col {
    min-width: 85px;
}

.actions-col-renew {
    text-align: left;
}

.actions-col-edit {
    text-align: left;
}

/* Pulsante dettaglio in tabella */
.btn-detail {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #e94560;
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn-detail:hover {
    background: rgba(233, 69, 96, 0.25);
    color: #ff6b8a;
}

/* Pagina dettaglio cliente */
.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-header h1 {
    margin: 0;
}

.detail-header-customer {
    flex-wrap: wrap;
    justify-content: space-between;
}

.detail-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-header-title .btn-back {
    align-self: flex-start;
}

.detail-dashboard-wrap {
    display: grid;
    grid-template-columns: minmax(0, 380px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .detail-dashboard-wrap {
        grid-template-columns: 1fr;
    }
}

.detail-dashboard-wrap .dashboard-section {
    min-width: 0;
}

.dashboard-section {
    margin-top: 0;
}

.dashboard-section h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #e6edf3;
}

.dashboard-section .table-wrapper {
    margin-top: 0;
}

.btn-back {
    color: #8b949e;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-back:hover {
    color: #e94560;
}

.detail-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.detail-card h2 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #8b949e;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
}

@media (max-width: 500px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-col .detail-list dt:first-child {
    margin-top: 0;
}

.detail-list {
    margin: 0;
}

.detail-list dt {
    font-size: 0.82rem;
    color: #8b949e;
    margin-top: 0.5rem;
}

.detail-list dt:first-child {
    margin-top: 0;
}

.detail-list dd {
    margin: 0.25rem 0 0 0;
    color: #e6edf3;
}

.detail-list a {
    color: #e94560;
}

.detail-list a:hover {
    color: #ff6b8a;
}

.detail-notes {
    margin: 0;
    color: #e6edf3;
    line-height: 1.5;
}

.detail-meta {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #8b949e;
}

/* Modale */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
}

.modal-content-customer,
.modal-content-landing {
    max-width: 560px;
}

.modal-body-landing .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-body-landing .form-row:last-of-type {
    margin-bottom: 0;
}

.modal-body-landing .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.modal-body-landing .form-row .form-group-full {
    flex: 1 1 100%;
}

.modal-body-landing .form-row-highlight {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #30363d;
}

.expiration-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #30363d;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, background 0.2s;
}

.radio-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: #484f58;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: rgba(233, 69, 96, 0.5);
    background: rgba(233, 69, 96, 0.08);
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.radio-option .radio-dot {
    display: none;
}

.radio-option input[type="radio"]:checked ~ .radio-label {
    color: #e6edf3;
    font-weight: 500;
}

.radio-option-custom {
    flex-wrap: wrap;
    align-items: center;
    padding-right: 0.5rem;
}

.radio-option-custom .expiration-custom-input {
    width: 130px;
    margin-left: 0.25rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #161b22;
    color: #e6edf3;
}

.radio-option-custom .expiration-custom-input:focus {
    outline: none;
    border-color: #e94560;
}

.modal-body-customer .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-body-customer .form-row:last-of-type {
    margin-bottom: 0;
}

.modal-body-customer .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.modal-body-customer .form-row .form-group-full {
    flex: 1 1 100%;
}

.modal-body-customer .form-row .form-group-narrow {
    flex: 0 0 100px;
}

.modal-body-customer .form-row-highlight {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #30363d;
}

.modal-body-customer .form-row-highlight .form-group {
    flex: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #30363d;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #e6edf3;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    color: #e6edf3;
    font-size: 1rem;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #e94560;
}

.modal-body input[readonly] {
    cursor: pointer;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #30363d;
}

.btn-modal-cancel {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem;
    margin-top: 0.5rem;
    background: transparent;
    border: 1px solid #e94560;
    border-radius: 8px;
    color: #e94560;
    cursor: pointer;
}

.btn-modal-cancel:hover {
    background: rgba(233, 69, 96, 0.1);
    color: #c73e54;
    border-color: #c73e54;
}

/* Pulsante Rinnova e modale rinnovo */
.btn-renew {
    display: inline-block;
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #3fb950;
    box-sizing: border-box;
    background: rgba(46, 160, 67, 0.2);
    border: 1px solid rgba(46, 160, 67, 0.4);
    border-radius: 6px;
    cursor: pointer;
}

.btn-renew:hover {
    background: rgba(46, 160, 67, 0.3);
    color: #56d364;
}

.modal-content-renew {
    max-width: 480px;
}

.renew-info-box {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.renew-info-label {
    color: #8b949e;
    font-size: 0.9rem;
}

.renew-info-date {
    color: #e6edf3;
    font-weight: 600;
    font-size: 1rem;
}

.renew-section {
    margin-bottom: 1.5rem;
}

.renew-section-title {
    margin: 0 0 0.75rem 0;
    color: #8b949e;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.renew-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.renew-form {
    margin: 0;
}

.btn-renew-option {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid rgba(46, 160, 67, 0.35);
    border-radius: 8px;
    color: #3fb950;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-renew-option:hover {
    background: rgba(46, 160, 67, 0.25);
    color: #56d364;
    border-color: rgba(46, 160, 67, 0.5);
}

.renew-custom {
    padding-top: 1.25rem;
    border-top: 1px solid #30363d;
}

.renew-custom .renew-section-title {
    margin-bottom: 0.75rem;
}

.renew-custom-form {
    margin: 0;
}

.renew-custom-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.renew-date-input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    color: #e6edf3;
    font-size: 1rem;
    cursor: pointer;
}

.renew-date-input:focus {
    outline: none;
    border-color: #e94560;
}

.renew-date-input::placeholder {
    color: #8b949e;
}

.btn-renew-custom {
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    background: #e94560;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-renew-custom:hover {
    background: #c73e54;
}
