/* Espaçamento extra entre DDI e número no intl-tel-input */
.iti .iti__selected-flag {
    margin-right: 12px;
}
.iti--allow-dropdown input {
    padding-left: 58px !important;
}
/* intl-tel-input integration styles */
.iti {
    width: 100%;
}
.iti input {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 15px;
    background: #f7f7fa;
}
@media (min-width: 900px) {
    .suppliers-table th, .suppliers-table td {
        font-size: 0.95em;
        white-space: nowrap;
    }
}
/* Ensure group collapsing works on desktop */
.grouped-supplier-row.hidden {
    display: none !important;
}
/* Stack Save/Cancel vertically below tick box in edit mode */
.tick-and-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.edit-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    width: 90px;
}
.edit-actions-vertical button {
    width: 100%;
    min-width: 80px;
    box-sizing: border-box;
    margin: 0;
}
/* Right-align action cell */
.action-cell {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}
/* Edit pencil icon */
.edit-pencil {
    font-size: 1.1em;
    color: #764ba2;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.edit-pencil:hover {
    opacity: 1;
}

/* Save button below table */
.save-suppliers-btn {
    float: right;
    margin-top: 18px;
    margin-bottom: 18px;
    min-width: 120px;
    font-size: 1.1em;
}
/* Garante espaçamento entre ícones de linguagem e botão login no header */
.lang-login-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5em;
}

.group-header-purple {
    background: #ede6f7 !important;
    font-size: 1.04em;
    font-weight: 600;
}
.group-header-left {
    text-align: left !important;
}

.btn-danger {
    background: #e53935;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    margin-top: 10px;
    margin-left: 10px;
    transition: background 0.2s;
}
.btn-danger:hover {
    background: #b71c1c;
}

/* Botões de ação de fornecedores */
.supplier-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
#show-form-btn {
    margin: 0;
    padding: 8px 18px;
}
#delete-supplier-btn {
    background: #38b000;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s, cursor 0.2s;
    margin: 0;
}
#delete-supplier-btn:disabled {
    opacity: 1;
    background: #cccccc;
    color: #888;
    cursor: not-allowed;
}
#supplier-form.modern-form {
    width: 100%;
    border-radius: 8px;
    padding: 18px 24px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}
.form-row {
    display: flex;
    gap: 18px;
    align-items: flex-end;
    flex-wrap: wrap;
    max-width: 700px;
    margin: 0 auto;
}
.form-group {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    flex: 1;
}
.form-group label {
    font-weight: 500;
    margin-bottom: 6px;
    color: #764ba2;
}
.form-group input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    background: #f7f7fa;
    transition: border 0.2s;
}
.form-group input:focus {
    border: 2px solid #764ba2;
    outline: none;
}
.form-btn {
    display: flex;
    align-items: flex-end;
    min-width: 140px;
}

/* Header alinhado como dashboard */
.main-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.main-header h1 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}
.main-nav {
    display: flex;
    gap: 20px;
}
.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.3s;
    font-weight: 500;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Cabeçalhos ordenáveis */
.suppliers-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}
.suppliers-table th.sortable:hover {
    background: #8d6fd1;
}
.suppliers-table th.sortable:after {
    content: '\25B2';
    font-size: 0.8em;
    color: #fff;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}
.suppliers-table th.sortable.sorted-desc:after {
    content: '\25BC';
}

/* Select de grupo dentro da tabela */
#group-filter {
    font-size: 0.95em;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #764ba2;
    background: #f7f7fa;
    color: #333;
    margin-left: 8px;
    outline: none;
    transition: border 0.2s;
    text-align: center;
}
#group-filter:focus {
    border: 2px solid #764ba2;
}

/* Células modernas */
.cell-name {
    font-weight: 600;
    color: #764ba2;
    font-size: 1.05em;
}
.cell-email {
    color: #667eea;
    font-size: 0.98em;
    word-break: break-all;
}
.cell-phone {
    color: #333;
    font-size: 0.98em;
}
.cell-group {
    background: #f3f0fa;
    color: #764ba2;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.97em;
}
.cell-date {
    color: #888;
    font-size: 0.95em;
}

/* Filtro de grupo */
.filter-group {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-group label {
    font-weight: 500;
    color: #764ba2;
}
.filter-group select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #764ba2;
    background: #f7f7fa;
    color: #333;
    font-size: 1em;
    outline: none;
    transition: border 0.2s;
}
.filter-group select:focus {
    border: 2px solid #764ba2;
}

/* Tabela de fornecedores */
.suppliers-table {
    width: 1000px;
    max-width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-left: auto;
    margin-right: auto;
}
.suppliers-table th, .suppliers-table td {
    padding: 12px 16px;
    text-align: center;
}
.group-th-center {
    text-align: center !important;
    vertical-align: middle;
}
.suppliers-table th {
    background: #764ba2;
    color: #fff;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}
.suppliers-table tr {
    transition: background 0.2s;
}
.suppliers-table tr:hover {
    background: #f3f0fa;
}
.suppliers-table td {
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

#suppliers-empty {
    text-align: center;
    color: #764ba2;
    font-size: 1.1em;
    margin-top: 24px;
    display: none;
}

/* suppliers.css - modern look */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.suppliers-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 24px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
}

.suppliers-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.suppliers-header h1 {
    font-size: 2.2em;
    margin: 0;
    color: #764ba2;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.08);
}
.suppliers-header .header-nav {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.suppliers-header .nav-link {
    color: #764ba2;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s;
    font-weight: 500;
    background: rgba(118, 75, 162, 0.08);
}
.suppliers-header .nav-link.active, 
.suppliers-header .nav-link:hover {
    background: #764ba2;
    color: white;
}

.suppliers-title {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 1.2em;
    color: #333;
}

#suppliers-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
#suppliers-table th, #suppliers-table td {
    padding: 16px 14px;
    text-align: left;
}
#suppliers-table th {
    background: #f5f3fa;
    color: #764ba2;
    font-size: 1.08em;
    font-weight: 600;
    border-bottom: 2px solid #e1e5e9;
}
#suppliers-table tr {
    transition: background 0.2s;
}
#suppliers-table tr:hover {
    background: #f3f0fa;
}
#suppliers-table td {
    border-bottom: 1px solid #f0f0f0;
    font-size: 1.04em;
}
#suppliers-empty {
    text-align: center;
    color: #764ba2;
    font-size: 1.1em;
    margin-top: 2em;
    display: none;
}

/* Formulário de novo fornecedor */
.btn-primary {
    background: #764ba2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 20px;
    transition: background 0.2s;
}
.btn-primary:hover {
    background: #5a357d;
}
.btn-success {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    margin-top: 10px;
    transition: background 0.2s;
}
.btn-success:hover {
    background: #218838;
}

#form-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 28px 32px;
    max-width: 480px;
    margin-bottom: 30px;
}
#supplier-form label {
    display: block;
    margin-top: 10px;
    font-weight: 500;
}
#supplier-form input {
    width: 100%;
    padding: 7px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.supplier-card {
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    font-size: 16px;
}

@media (max-width: 768px) {

    .main-header {
        padding: 0.5rem 0.5rem !important;
        flex-direction: column;
        align-items: flex-start;
    }

    .main-header h1,
    .suppliers-header h1 {
        font-size: 1.1rem;
        text-align: center;
        width: 100%;
        margin: 0 auto;
        display: block;
    }

    .main-header > div {
        display: flex !important;
        flex-direction: column !important;
        width: 100%;
        gap: 0.5em;
    }

    .main-nav {
        display: flex !important;
        flex-direction: column !important;
        width: 100%;
        gap: 0 !important;
    }

    .nav-link {
        display: inline-flex !important;
        align-items: center;
        gap: 0.4em;
        white-space: nowrap;
        width: 100%;
        justify-content: flex-start;
        font-size: 1rem;
        box-sizing: border-box;

        /* padding e margin mais enxutos */
        padding-top: 4px !important;
        padding-bottom: 4px !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        line-height: 1.2 !important;
    }

    .main-header > div > div:nth-child(2),
    .main-header > div > #user-header-info {
        order: 2;
        width: 100%;
        display: flex !important;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.5em;
        margin-bottom: 0.5em;
    }

    /* Hide table structure on mobile */
    .suppliers-table,
    .suppliers-table thead,
    .suppliers-table tbody,
    .suppliers-table tr,
    .suppliers-table th,
    .suppliers-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .suppliers-table thead {
        display: none !important;
    }

    /* Supplier row → card */
    .suppliers-table tr {
        margin-bottom: 16px;
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 4px 12px rgba(118, 75, 162, 0.12);
        border: 1px solid #ece5f5;
        padding: 14px;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .suppliers-table tr:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(118, 75, 162, 0.18);
    }

    .suppliers-table tr:last-child {
        margin-bottom: 0;
    }

    .suppliers-table td {
        border: none;
        text-align: left;
        padding: 6px 0;
        font-size: 0.95em;
    }

    /* Field label inside card */
    .suppliers-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #764ba2;
        display: block;
        margin-bottom: 2px;
        font-size: 0.85em;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    /* Make name more prominent */
    .suppliers-table td.cell-name {
        font-size: 1.1em;
        font-weight: 700;
        color: #5a357d;
        margin-bottom: 6px;
    }

    .suppliers-table td.cell-email {
        word-break: break-word;
        color: #4a60d0;
    }

    .suppliers-table td.cell-group {
        background: #f3f0fa;
        color: #764ba2;
        padding: 4px 10px;
        border-radius: 8px;
        font-weight: 500;
        display: inline-block;
        margin-top: 4px;
    }
}

/* Force group children to really hide/show on mobile too */
.grouped-supplier-row {
    display: table-row; /* default desktop */
}

@media (max-width: 768px) {
    .grouped-supplier-row {
        display: block; /* cards on mobile */
    }
    .grouped-supplier-row.hidden {
        display: none !important; /* allow JS to collapse */
    }
}

