/* Importa gli stili di base */
@import url('base.css');

/**
 * Tabelle
 * -----------------------------------------------------------------------------
 */

/* Stili per la tabella principale */
#licenses-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9em;
    table-layout: fixed;
}

#licenses-table th, 
#licenses-table td {
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: middle;
}

#licenses-table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

/* Definisce larghezze fisse per le colonne */
#licenses-table th:nth-child(1), 
#licenses-table td:nth-child(1) {
    width: 35%;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

#licenses-table th:nth-child(2), 
#licenses-table td:nth-child(2) {
    width: 15%;
    white-space: nowrap;
}

#licenses-table th:nth-child(3), 
#licenses-table td:nth-child(3) {
    width: 25%;
}

#licenses-table th:nth-child(4), 
#licenses-table td:nth-child(4) {
    width: 25%;
}

/* Regola rimossa come richiesto */

#licenses-table td[style='text-align:right;'] {
    text-align: right;
}

/* Intestazioni delle tabelle e ordinamento */
th a {
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

th a:hover {
    text-decoration: underline;
}

th i {
    margin-left: 5px;
}

/* Stili per la tabella interna */
.inner-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85em;
    table-layout: fixed;
    max-width: 100%;
}

.inner-table th,
.inner-table td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
}

.inner-table th {
    background-color: #f2f2f2;
    font-size: 0.9em;
}

/* Larghezze specifiche per le colonne della tabella interna */
/* Per la tabella subscription-history */
tr[id^="subscription-history"] .inner-table th:nth-child(1),
tr[id^="subscription-history"] .inner-table td:nth-child(1) {
    width: 25%; /* Data */
}

tr[id^="subscription-history"] .inner-table th:nth-child(2),
tr[id^="subscription-history"] .inner-table td:nth-child(2) {
    width: 35%; /* Event Type */
}

tr[id^="subscription-history"] .inner-table th:nth-child(3),
tr[id^="subscription-history"] .inner-table td:nth-child(3) {
    width: 25%; /* Status */
}

/* Per la tabella activation-keys - 5 colonne più strette */
tr[id^="activation-keys"] .inner-table th:nth-child(1),
tr[id^="activation-keys"] .inner-table td:nth-child(1) {
    width: 20%; /* Package Name */
}

tr[id^="activation-keys"] .inner-table th:nth-child(2),
tr[id^="activation-keys"] .inner-table td:nth-child(2) {
    width: 30%; /* Activation Key */
}

tr[id^="activation-keys"] .inner-table th:nth-child(3),
tr[id^="activation-keys"] .inner-table td:nth-child(3),
tr[id^="activation-keys"] .inner-table th:nth-child(4),
tr[id^="activation-keys"] .inner-table td:nth-child(4) {
    width: 20%; /* Date columns */
}

tr[id^="activation-keys"] .inner-table th:nth-child(5),
tr[id^="activation-keys"] .inner-table td:nth-child(5) {
    width: 10%; /* Status */
}

/* Tabella dettagli */
.details-table {
    width: 100%;
    border-collapse: collapse;
}

.details-table th,
.details-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.details-table th {
    font-size: 0.9em;
    font-weight: bold;
    padding-right: 15px;
    text-align: left;
    width: 40%;
    color: #555;
}

.details-table td {
    color: #333;
}

.keys-table {
    margin-top: 0;
}

/**
 * Layout e Componenti
 * -----------------------------------------------------------------------------
 */

/* Stili per lo stato e le chiavi */
.status-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-info-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.keys-info {
    font-weight: normal;
}

.keys-info strong {
    font-weight: bold;
}

.keys-info.no-keys-available {
    color: #dc3545;
    font-weight: bold;
}

/* Stili per le azioni */
.actions-header {
    width: 1%;
}

td.actions {
    white-space: nowrap;
}

.invoice-link,
.btn-cancel-subscription,
.btn-renew-subscription,
.btn-reactivate-subscription {
    color: #007bff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.invoice-link:hover,
.btn-cancel-subscription:hover,
.btn-renew-subscription:hover,
.btn-reactivate-subscription:hover {
    text-decoration: underline;
    color: #0056b3;
}

.invoice-link i {
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    font-size: 14px;
}

.subscription-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.btn-cancel-subscription {
    color: #dc3545;
}

.btn-renew-subscription,
.btn-reactivate-subscription {
    color: #28a745;
}

/* Stili per la sezione di filtro */
.filter-section {
    margin-bottom: 20px;
}

.filter-section form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section select,
.filter-section .select2-container {
    flex: 1;
    margin-right: 10px;
    width: 100% !important;
    min-width: 200px;
    vertical-align: middle !important;
}

.filter-section .select2-container {
    margin-top: 0 !important;
}

.filter-section .select2-container .select2-selection {
    height: 34px !important;
    line-height: 34px !important;
}

.filter-section .select2-container .select2-selection__rendered {
    line-height: 34px !important;
}

/* Fix per tutti i select2 container */
.select2-container--default {
    margin-top: 0 !important;
}

.filter-section button {
    flex-shrink: 0;
    height: 34px;
    vertical-align: middle;
}

/**
 * Accordion
 * -----------------------------------------------------------------------------
 */

.accordion-btn {
    cursor: pointer;
    padding: 5px 10px;
    margin: 2px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.accordion-btn .fa-chevron-down {
    transition: transform 0.3s ease-in-out;
}

.accordion-btn.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* Stili per i contenuti dell'accordion */
.accordion-content {
    display: none;
    padding: 0;
    border: none;
    margin: 0;
    width: 100%;
}

.accordion-content.active {
    display: table-row;
    width: 100%;
}

.accordion-content td[colspan="4"] {
    width: 100% !important;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    display: table-cell;
}

/* Contenitore dell'accordion con overflow nascosto */
.accordion-content td[colspan="4"] > * {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/**
 * Layout pagina Dettagli Ordine
 * -----------------------------------------------------------------------------
 */

.order-details {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.order-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.back-icon {
    margin-right: 15px;
    font-size: 16px;
    color: #0088cc;
    text-decoration: none;
    display: flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 3px;
    background-color: #f5f5f5;
    transition: background-color 0.2s ease;
}

.back-icon:hover {
    background-color: #e0e0e0;
}

.back-icon i {
    vertical-align: middle;
    line-height: 28px;
}

.button-group {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

.button-group .btn {
    padding: 8px 16px;
    color: #0088cc;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.button-group .btn:hover {
    color: #006699;
    text-decoration: underline;
}

.order-columns {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
    gap: 20px;
    width: 100%;
}

.order-column {
    padding: 0 15px;
}

.order-column-70 {
    flex: 7;
    min-width: 300px;
}

.order-column-30 {
    flex: 3;
    min-width: 250px;
}

.order-column-50 {
    flex: 5;
    min-width: 250px;
}

.order-column-100 {
    flex: 1 0 100%;
    width: 100%;
}

.order-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 20px;
    gap: 20px;
}

.order-section {
    margin-bottom: 30px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
}

.order-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2em;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Font size ridotto per i widget order_information e customer_information */
#order-info-section h3,
#customer-info-section h3 {
    font-size: 1.1em;
}

.collapse-section-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #777;
    padding: 3px 6px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.collapse-section-btn:hover {
    background-color: #f0f0f0;
}

.collapse-section-btn i {
    display: inline-block;
}

.order-section-content {
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
}

.order-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/**
 * Form
 * -----------------------------------------------------------------------------
 */

/* Stili per il form di creazione delle chiavi nella pagina dettagli */
.create-key-form {
    margin-top: 10px;
}

.create-key-form .form-group {
    margin-bottom: 20px;
}

.create-key-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #444;
    font-size: 15px;
}

.create-key-form .form-description {
    margin: 5px 0 10px;
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

.create-key-form .form-control {
    width: 98%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.create-key-form .form-control:focus {
    border-color: #0088cc;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05), 0 0 5px rgba(0,136,204,0.3);
}

/* Stile per i campi statici del form */
.create-key-form .form-control-static {
    padding: 10px 12px;
    margin-bottom: 0;
    width: 98%;
    font-size: 14px;
    line-height: 1.42857143;
    color: #333;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 38px;
    display: flex;
    align-items: center;
}

.create-key-form .form-actions {
    margin-top: 20px;
}

.create-key-form .btn-primary {
    background-color: #0088cc;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.create-key-form .btn-primary:hover {
    background-color: #006699;
}

.create-activation-key-form {
    margin-bottom: 15px;
}

.sku-order-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    width: 100%;
}

.sku-label {
    width: 40%;
    margin-right: 1%;
    font-weight: normal;
    font-size: 0.8em;
    white-space: normal;
    overflow: visible;
    line-height: 1.2;
    padding-top: 4px;
}

.order-select {
    width: 45%;
    margin-right: 1%;
}

.new-key-btn {
    width: 10%;
    white-space: nowrap;
    padding: 5px;
    text-align: center;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 1%;
}

.new-key-btn:hover {
    background-color: #0056b3;
}

.new-key-btn i {
    display: inline-block;
    width: 100%;
    text-align: center;
}

.sku-order-group label {
    display: inline-block;
    /* width: 150px; */
}

.sku-order-group select {
    width: 300px;
}

/**
 * Login
 * -----------------------------------------------------------------------------
 */

/* Stili per la pagina di login */
#loginBox {
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
}

#loginBox h1 {
    color: #596a7b;
    font-size: 28px;
    margin-bottom: 8px;
}

#loginBox p {
    color: #596a7b;
    font-size: 16px;
    margin-bottom: 25px;
}

#loginBox form {
    margin-bottom: 15px;
}

#loginBox form > div {
    margin-bottom: 15px;
}

#loginBox label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
}

#loginBox input[type="text"],
#loginBox input[type="password"],
.login_radaee {
    width: 100% !important;
    margin: 2px 0 0 0 !important;
    padding: 6px 20px !important;
    border: 1px solid #ccc !important;
    border-radius: 3px !important;
    box-sizing: border-box !important;
}

#loginBtn {
    width: 100% !important;
    text-align: center !important;
    margin-top: 10px !important;
}

#loginBox .error {
    color: #e55a4d !important;
    margin-bottom: 15px !important;
    font-weight: bold !important;
}

#loginBox .btn {
    background-color: #0088cc !important;
    border: none !important;
    border-radius: 3px !important;
    color: white !important;
    cursor: pointer !important;
    font-size: 16px !important;
    padding: 8px 12px !important;
    width: 100% !important;
    text-transform: uppercase !important;
}

#loginBox .btn:hover {
    background-color: #006699 !important;
}

#loginLinks {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.forgot-link {
    float: left;
}

.create-link {
    float: right;
}

#loginLinks a {
    color: #2a9af0;
    text-decoration: none;
}

#loginLinks a:hover {
    text-decoration: underline;
}

/**
 * Responsive
 * -----------------------------------------------------------------------------
 */

@media (max-width: 768px) {
    .order-column {
        flex: 100%;
    }
    
    .order-columns {
        display: block;
    }

    #loginBox {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
}
