/* Importarea unui font modern de pe Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Resetări de bază și stiluri globale */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f7f6;
    color: #333;
    transition: margin-left 0.3s ease;
}

/* Structura principală */
.container {
    display: flex;
}

/* Bara laterală (Meniu) */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: -250px; /* Ascuns implicit */
    background-color: #2c3e50;
    color: #ecf0f1;
    padding-top: 20px;
    transition: left 0.3s ease;
    z-index: 1000;
}

.sidebar.active {
    left: 0; /* Afișat la click */
}

.sidebar h3 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar ul li a:hover {
    background-color: #34495e;
    border-left: 3px solid #3498db;
}

.sidebar ul li.active > a {
    background-color: #34495e;
    font-weight: 500;
}

/* Submeniu pentru Widgets */
.submenu {
    list-style: none;
    padding-left: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.submenu.show {
    max-height: 200px; /* O valoare suficient de mare pentru a afișa elementele */
}

.submenu li a {
    font-size: 0.9em;
    padding-left: 30px;
}

/* Conținutul principal */
.main-content {
    flex-grow: 1;
    padding: 20px;
    transition: margin-left 0.3s ease;
    margin-left: 0;
}

.main-content.shifted {
    margin-left: 250px;
}

/* Bara de sus cu butonul de meniu */
.top-bar {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.menu-toggle {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 24px;
    color: #2c3e50;
    margin-right: 20px;
}

.top-bar h1 {
    font-size: 1.8em;
    color: #2c3e50;
}

/* Carduri pentru statistici (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card h3 {
    font-size: 1.1em;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.stat-card .count {
    font-size: 2.5em;
    font-weight: 700;
    color: #3498db;
}

.stat-card.expired .count {
    color: #e74c3c;
}

/* Tabelul de date */
.data-table-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-container {
    flex-grow: 1;
}

.search-container input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 300px;
    font-size: 14px;
}

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

.filter-container span {
    font-weight: 500;
    color: #555;
    margin-right: 5px;
}

.filter-btn {
    padding: 8px 15px;
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.filter-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}


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

.data-table th, .data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #34495e;
}

.data-table th[data-sort] {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.data-table th[data-sort]:hover {
    background-color: #e9ecef;
}

.sort-icon {
    font-size: 12px;
    margin-left: 5px;
    color: #999;
    display: inline-block;
    width: 1em;
}

.data-table th.sorted-asc .sort-icon::after {
    content: '▲';
}

.data-table th.sorted-desc .sort-icon::after {
    content: '▼';
}


.data-table tbody tr:hover {
    background-color: #f4f7f6;
}

.action-cell {
    position: relative;
}

.action-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.action-button:hover {
    background-color: #2980b9;
}

.action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 5px;
    z-index: 10;
    min-width: 180px;
    overflow: hidden;
}

.action-dropdown.show {
    display: block;
}

.action-item {
    display: block;
    padding: 12px 15px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.action-item:hover {
    background-color: #f4f7f6;
}

.custom-input-group {
    display: flex;
    padding: 8px 15px;
    gap: 8px;
    align-items: center;
}

/* --- CORECȚIA ESTE AICI --- */
.custom-input {
    flex-grow: 1; /* Permite câmpului să ocupe spațiul disponibil */
    min-width: 50px; /* Previne micșorarea excesivă */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.custom-input[type=number] {
    -moz-appearance: textfield;
}

.custom-submit {
    padding: 8px 12px;
    border: none;
    background-color: #27ae60;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0;
}

.custom-submit:hover {
    background-color: #229954;
}

.sync-btn {
    display: inline-block;
    padding: 10px 18px;
    background-color: #27ae60;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.sync-btn:hover {
    background-color: #229954;
}
.sync-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
}

.sync-log-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.6;
}

.sync-log-container p {
    margin: 0 0 5px 0;
    padding-bottom: 5px;
    border-bottom: 1px dotted #e0e0e0;
}
.sync-log-container p:last-child {
    border-bottom: none;
}
.sync-log-container .success {
    color: #27ae60;
}
.sync-log-container .error {
    color: #e74c3c;
    font-weight: bold;
}

.modal-close-btn {
    display: block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    align-self: flex-end;
}
