/* ============================================
   BEMAX DNS - Stile Professionale
   Colori Aziendali:
   - Primario: #245791 (36, 87, 145)
   - Scuro:    #1E1E1E (30, 30, 30)
   - Chiaro:   #D7D7D7 (215, 215, 215)
   ============================================ */

:root {
    --primary: #245791;
    --primary-dark: #1a4270;
    --primary-light: #3a6fa8;
    --dark: #1E1E1E;
    --dark-secondary: #2a2a2a;
    --dark-tertiary: #363636;
    --light: #D7D7D7;
    --light-secondary: #e8e8e8;
    --white: #ffffff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 20px 40px rgba(36, 87, 145, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-secondary) 100%);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

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

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

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== NAVBAR ===== */
.navbar {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(215, 215, 215, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand img {
    height: 40px;
    width: auto;
}

.navbar-brand span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.navbar-menu a {
    color: var(--light);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.navbar-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.navbar-menu a:hover::after,
.navbar-menu a.active::after {
    width: 100%;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--light);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(36, 87, 145, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(36, 87, 145, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--light);
    border: 1px solid var(--light);
}

.btn-secondary:hover {
    background: var(--light);
    color: var(--dark);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ===== CARDS ===== */
.card {
    background: var(--dark-secondary);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(215, 215, 215, 0.05);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
    border-color: rgba(36, 87, 145, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(215, 215, 215, 0.1);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin: 0;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--light);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--dark-tertiary);
    border: 1px solid rgba(215, 215, 215, 0.2);
    border-radius: var(--border-radius-sm);
    color: var(--white);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36, 87, 145, 0.2);
}

.form-control::placeholder {
    color: rgba(215, 215, 215, 0.5);
}

.form-text {
    font-size: 0.875rem;
    color: rgba(215, 215, 215, 0.7);
    margin-top: 0.25rem;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--primary);
    color: var(--white);
    padding: 1rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(215, 215, 215, 0.1);
    color: var(--light);
}

.table tbody tr {
    background: var(--dark-secondary);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--dark-tertiary);
}

/* ===== DASHBOARD STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--dark-secondary) 0%, var(--dark-tertiary) 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--light);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-icon {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.2;
}

/* ===== DOMAIN CARDS ===== */
.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.domain-card {
    background: var(--dark-secondary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid rgba(215, 215, 215, 0.05);
    transition: var(--transition);
    position: relative;
}

.domain-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--box-shadow-hover);
}

.domain-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.domain-status.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.domain-status.inactive {
    background: var(--danger);
}

.domain-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

.domain-info {
    color: var(--light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.domain-ip {
    background: var(--dark);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.domain-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid var(--success);
    color: #2ecc71;
}

.alert-error, .alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--danger);
    color: #e74c3c;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning);
    color: #f39c12;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid var(--info);
    color: #3498db;
}

/* ===== LOGIN/REGISTER PAGES ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    background: var(--dark-secondary);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(215, 215, 215, 0.05);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo img {
    height: 60px;
    margin-bottom: 1rem;
}

.auth-title {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(215, 215, 215, 0.1);
    color: var(--light);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--dark);
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid rgba(215, 215, 215, 0.05);
    color: var(--light);
    text-align: center;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: rgba(215, 215, 215, 0.6); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .navbar-menu {
        gap: 1rem;
    }
    
    .navbar-brand span {
        font-size: 1.25rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .domain-grid {
        grid-template-columns: 1fr;
    }
    
    .table th, .table td {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .container {
        padding: 0 1rem;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar-brand img {
        height: 30px;
    }
    
    .navbar-brand span {
        font-size: 1.25rem;
    }
    
    .navbar-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--dark-secondary);
        padding: 0.75rem;
        justify-content: space-around;
        border-top: 1px solid rgba(215, 215, 215, 0.1);
        z-index: 1000;
    }
    
    .navbar-menu a {
        flex-direction: column;
        font-size: 0.75rem;
        text-align: center;
    }
    
    .navbar-user {
        font-size: 0.875rem;
    }
    
    .btn-logout {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .domain-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .table-container {
        margin: 0 -1rem;
        border-radius: 0;
    }
    
    .table th, .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.75rem;
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    .btn {
        padding: 0.75rem 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .d-flex {
        flex-direction: column;
    }
    
    .gap-2, .gap-3 {
        gap: 0.5rem;
    }
    
    /* Bottom padding per menu mobile */
    main {
        padding-bottom: 80px;
    }
    
    .footer {
        margin-bottom: 60px;
        padding: 1rem 0;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .auth-logo img {
        height: 40px;
    }
    
    .navbar-brand span {
        display: none;
    }
    
    .navbar-brand img {
        height: 35px;
    }
}

/* Touch-friendly */
button, .btn, a, input[type="submit"] {
    min-height: 44px;
}

@media (hover: none) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
}

/* Fix per iOS */
input, select, textarea {
    -webkit-appearance: none;
    border-radius: var(--border-radius-sm);
}

/* ===== TABLE IMPROVEMENTS ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;  /* Permette alle colonne di adattarsi */
}

.table th {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(215, 215, 215, 0.1);
    color: var(--light);
}

/* Pulsanti azioni nella tabella */
.table .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Container della tabella - occupa tutta la larghezza */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--border-radius);
    margin: 0;
}

/* Card che contiene la tabella */
.card .table-container {
    margin: -2rem;
    margin-top: 0;
    width: calc(100% + 4rem);
}

.card .table-container:first-child {
    margin-top: -2rem;
}

/* Codice inline nella tabella */
.table code {
    display: inline;
    padding: 0.25rem 0.5rem;
    background: var(--dark);
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Responsive per tabella */
@media (max-width: 768px) {
    .card .table-container {
        margin: -1.25rem;
        width: calc(100% + 2.5rem);
    }
    
    .table th,
    .table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ============================================
   MIGLIORAMENTI DI CONTRASTO E LEGGIBILITÀ
   ============================================ */

body, p, .text-muted, .form-text, label, .auth-footer, .auth-footer a {
    color: #E8E8E8 !important;
}

.text-muted, .form-text {
    opacity: 0.85 !important;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.auth-footer a {
    color: #6BA0D9 !important;
    font-weight: 500;
}

.auth-footer a:hover {
    color: #FFFFFF !important;
}

/* ============================================
   CORREZIONI PAGINA DI LOGIN
   ============================================ */

/* Logo: spostato in alto e ingrandito */
.auth-logo img {
    height: auto !important;
    width: auto !important;
    max-width: 180px !important;
    max-height: 65px !important;
    margin-top: -12px !important;
    margin-bottom: 8px !important;
    transform: scale(1.16);
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Dynamic DNS Service: rimpicciolito e spostato in alto */
.auth-logo p.text-muted {
    font-size: 0.9rem !important;
    margin-top: -24px !important;
    margin-bottom: 16px !important;
}

/* Elimina "Inserisci le tue credenziali" */
.auth-title p.text-muted {
    display: none !important;
}

/* Box IP esterno: centrato e ridotto */
.alert.alert-info#ip-display {
    width: 80% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 0.75rem !important;
    font-size: 0.95rem !important;
}

#user-ip {
    color: #FFFFFF !important;
    font-weight: 700;
}

/* ============================================
   LOGO: +20% rispetto alla dimensione attuale
   ============================================ */

/* 
   Dimensione attuale: scale(1.20)
   +20% aggiuntivo: 1.20 * 1.20 = 1.44
*/
.auth-logo img {
    transform: scale(1.44) !important;
}

/* ============================================
   SPOSTA DYNAMIC DNS SERVICE IN BASSO
   ============================================ */

.auth-logo p.text-muted {
    margin-top: 2px !important;  /* -12px + 14px = 2px */
    text-transform: lowercase !important;
}

/* ============================================
   SPOSTA DYNAMIC DNS SERVICE IN BASSO
   ============================================ */

.auth-logo p.text-muted {
    margin-top: 2px !important;  /* -12px + 14px = 2px */
    text-transform: lowercase !important;
}

/* ============================================
   MODIFICA SCRITTA "ACCEDI"
   ============================================ */

/* 
   Posizione precedente: margin-top: 16px
   Nuova posizione: 16px + 14px = 30px
   Dimensione precedente: calc(1.5rem - 5pt)
   Nuova dimensione: calc(1.5rem - 7pt)  (-2pt aggiuntivi)
*/
.auth-title h2 {
    margin-top: 30px !important;
    font-size: calc(1.5rem - 7pt) !important;
}

/* ============================================
   MODIFICA SCRITTA "ACCEDI"
   ============================================ */

/* 
   Posizione precedente: margin-top: 16px
   Nuova posizione: 16px + 14px = 30px
   Dimensione precedente: calc(1.5rem - 5pt)
   Nuova dimensione: calc(1.5rem - 7pt)  (-2pt aggiuntivi)
*/
.auth-title h2 {
    margin-top: 46px !important;
    font-size: calc(2rem - 8pt) !important;
}

/* ============================================
   MODIFICA SCRITTA "REGISTRATI"
   ============================================ */

.auth-logo h2 {
    font-size: calc(2rem - 8pt) !important;
    margin-top: 46px !important;
}

/* ============================================
   MODIFICA SCRITTA "REGISTRATI"
   ============================================ */

.auth-logo h2 {
    font-size: calc(2rem - 10pt) !important;
    margin-top: 46px !important;
}

/* ============================================
   MODIFICA SCRITTA "REGISTRATI"
   ============================================ */

.auth-logo h2 {
    font-size: calc(1,2rem - 10pt) !important;
    margin-top: 46px !important;
}

/* ============================================
   MODIFICA SCRITTA "REGISTRATI" - PAGINA REGISTER
   ============================================ */

/* Selettore specifico per la pagina di registrazione */
.auth-card .auth-logo h2 {
    font-size: calc(2rem - 8pt) !important;
    margin-top: 46px !important;
}

/* Alternativo se il precedente non funziona */
.auth-container .auth-card h2 {
    font-size: calc(2rem - 8pt) !important;
    margin-top: 46px !important;
}

/* ============================================
   MODIFICA SCRITTA "REGISTRATI" - CLASSE SPECIFICA
   ============================================ */

.register-title {
    font-size: calc(2rem - 8pt) !important;
    margin-top: 46px !important;
}
