:root {
    --primary: #85AB76;
    --primary-dark: #749565;
    --secondary: #AF6F47;
    --secondary-dark: #9A6240;
    --danger: #A50C0C;
    --danger-dark: #8B0A0A;
    --background: #f8fafc;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

.societes-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.societes-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

#societes-search {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

#societes-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(133, 171, 118, 0.2);
}

.elementor-button {
    padding: 0.75rem !important;
    border-radius: 6px !important;
    min-height: 42px !important;
    min-width: 42px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.elementor-button.elementor-button-success {
    background-color: var(--primary) !important;
    color: white !important;
}

.elementor-button.elementor-button-success:hover {
    background-color: var(--primary-dark) !important;
}

.elementor-button.elementor-button-danger {
    background-color: var(--danger) !important;
    color: white !important;
}

.elementor-button.elementor-button-danger:hover {
    background-color: var(--danger-dark) !important;
}

.elementor-button.elementor-button-secondary {
    background-color: var(--secondary) !important;
    color: white !important;
}

.elementor-button.elementor-button-secondary:hover {
    background-color: var(--secondary-dark) !important;
}

.societes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.societes-grid .societe-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    padding: 1.5rem;
}

.societes-grid .societe-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.societes-grid .societe-color {
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: var(--shadow);
}

.societes-grid .societe-content {
    padding: 0.5rem;
}

.societes-grid h3 {
    margin: 0 0 1rem;
    padding-right: 2.5rem;
    font-size: 1.25rem;
    color: var(--text);
}

.societes-grid .societe-details {
    margin-bottom: 1.5rem;
}

.societes-grid .societe-details > div {
    margin-bottom: 0.75rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.societes-grid .societe-details i {
    color: var(--primary);
    width: 1rem;
    text-align: center;
}

.societes-grid .societe-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.societes-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: none !important;
}

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

.societes-table thead th:first-child {
    border-top-left-radius: 12px;
}

.societes-table thead th:last-child {
    border-top-right-radius: 12px;
}

.societes-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.societes-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.societes-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.societes-table tbody tr:last-child td {
    border-bottom: none;
}

.societes-table .name-with-color {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.societes-table .color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.societes-table .actions-column {
    text-align: right;
    white-space: nowrap;
    padding-right: 1.5rem;
}

.societes-table .actions-column .elementor-button {
    margin-left: 0.5rem;
}

#societe-form-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 8px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 999999;
    overflow-y: auto;
}

#societe-form-panel.open {
    right: 0;
}

.societe-form-content {
    padding: 2rem;
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
}

#close-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-row-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="text"],
input[type="tel"],
input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(133, 171, 118, 0.2);
}

input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 0.25rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.contacts-table,
.contacts-modal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.contacts-table thead th,
.contacts-modal-table thead th {
    background: var(--secondary);
    color: white;
    padding: 0.75rem;
    font-weight: 500;
    text-align: left;
}

.contacts-table td,
.contacts-modal-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    background: white;
}

.contacts-table tr:last-child td,
.contacts-modal-table tr:last-child td {
    border-bottom: none;
}

.contact-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-actions button {
    width: 100%;
}

#add-contact {
    width: 100%;
    margin-top: 1rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999999;
}

.modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    background: white;
    border-radius: 12px;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .societes-header {
        flex-direction: column;
    }
    .search-wrapper {
        width: 100%;
    }
    .form-row-double {
        grid-template-columns: 1fr;
    }
    .societes-grid {
        grid-template-columns: 1fr;
    }
    .societes-table {
        display: block;
        overflow-x: auto;
    }
    #societe-form-panel {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }
    .contacts-table,
    .contacts-modal-table {
        display: block;
        overflow-x: auto;
    }
}