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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
}

/* Utilități */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    min-height: 44px; /* Minim pentru touch */
    text-align: center;
    white-space: nowrap;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #f59e0b !important;
    color: white !important;
    border: 1px solid #d97706;
}

.btn-warning:hover {
    background: #d97706 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:active {
    background: #b45309 !important;
    transform: translateY(0);
}

.btn-edit {
    background: #059669 !important;
    color: white !important;
    border: 1px solid #047857;
}

.btn-edit:hover {
    background: #047857 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.btn-edit:active {
    background: #065f46 !important;
    transform: translateY(0);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 36px;
}

/* Butoane dezactivate - gri */
.btn:disabled,
.btn.disabled {
    background: #9ca3af !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    border-color: #d1d5db !important;
}

.btn:disabled:hover,
.btn.disabled:hover {
    background: #9ca3af !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Layout responsive */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page - Mobile First */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    width: 80px;
    height: auto;
    margin-bottom: 15px;
}

.login-header h1 {
    color: white;
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 10px;
}

.login-form {
    background: white;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px; /* Previne zoom pe iOS */
    transition: border-color 0.3s ease;
    min-height: 44px; /* Touch friendly */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
}

.error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

/* Dashboard Header - Responsive */
.dashboard-header {
    background: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.logo-small {
    width: 32px;
    height: auto;
    margin-right: 12px;
}

.header-left h2 {
    color: #1f2937;
    font-size: 18px;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#user-info {
    color: #6b7280;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Dashboard Main - Mobile First */
.dashboard-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}

/* Sidebar - Mobile Navigation */
.sidebar {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    order: 2;
}

.nav-menu {
    list-style: none;
    display: flex;
    overflow-x: auto;
    padding: 0 16px;
}

.nav-link {
    display: block;
    padding: 16px 20px;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

.nav-link.active {
    background: #eef2ff;
    color: #4f46e5;
    border-bottom: 3px solid #4f46e5;
}

.admin-only {
    display: none;
}

/* Content Area */
.content {
    flex: 1;
    padding: 20px 16px;
    background: #f9fafb;
    order: 1;
}

.content-section {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.content-section.active {
    display: block;
}

.content-section h3 {
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
}

/* Forms - Mobile Responsive */
.profile-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Users Management */
.users-actions {
    margin-bottom: 20px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users-table thead,
.users-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.users-table th,
.users-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lățimi specifice pentru coloane */
.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 8%;
    text-align: center;
    font-weight: 600;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 18%;
    font-weight: 500;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 22%;
    font-size: 13px;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 15%;
    text-align: center;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 12%;
    text-align: center;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
    width: 10%;
    text-align: center;
    font-weight: 500;
}

.users-table th:nth-child(7),
.users-table td:nth-child(7) {
    width: 10%;
    text-align: center;
}

.users-table th:nth-child(8),
.users-table td:nth-child(8) {
    width: 15%;
    text-align: center;
}

.users-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    position: sticky;
    top: 0;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.users-table tbody tr {
    transition: background-color 0.2s ease;
}

.users-table tbody tr:hover {
    background: #f8fafc;
}

.users-table tbody tr:nth-child(even) {
    background: #fefefe;
}

.users-table tbody tr:nth-child(even):hover {
    background: #f8fafc;
}

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Modal - Mobile Responsive */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 50px;
}

.modal-content {
    background: white;
    padding: 24px 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 16px;
    color: #1f2937;
    font-size: 18px;
}

.modal-content p {
    margin-bottom: 20px;
    color: #6b7280;
    line-height: 1.6;
}

/* Canvas pentru semnătură */
.signature-container {
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    margin-top: 10px;
}

.signature-canvas {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
    touch-action: none; /* Previne scroll pe touch devices */
}

.signature-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Stiluri pentru butoanele de acțiuni în interfața utilizatorilor */
.users-actions .btn {
    margin-right: 10px;
    margin-bottom: 10px;
}

.users-actions .btn-primary {
    background: #3b82f6;
    border: 1px solid #2563eb;
}

.users-actions .btn-primary:hover {
    background: #2563eb;
    border-color: #1d4ed8;
}

/* Îmbunătățiri pentru butoanele din modal */
.modal .btn {
    min-width: 120px;
}

.modal .btn-primary {
    background: #3b82f6;
    border: 1px solid #2563eb;
}

.modal .btn-secondary {
    background: #6b7280;
    border: 1px solid #4b5563;
}

/* Stiluri pentru tabelul de utilizatori pe mobile */
.user-card .btn {
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
}

/* Asigură că butoanele edit sunt verzi în toate contextele */
.users-table .btn-edit,
.user-card .btn-edit,
#users-list .btn-edit {
    background: #059669 !important;
    color: white !important;
    border: 1px solid #047857 !important;
}

.users-table .btn-edit:hover,
.user-card .btn-edit:hover,
#users-list .btn-edit:hover {
    background: #047857 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

/* Prioritate maximă pentru butoanele edit - suprascrie orice alt stil */
button.btn-edit,
.btn.btn-edit {
    background: #059669 !important;
    color: white !important;
    border: 1px solid #047857 !important;
}

button.btn-edit:hover,
.btn.btn-edit:hover {
    background: #047857 !important;
    color: white !important;
    border: 1px solid #047857 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

button.btn-edit:active,
.btn.btn-edit:active {
    background: #065f46 !important;
    color: white !important;
    transform: translateY(0);
}

/* Stiluri specifice pentru butoanele din tabelul de utilizatori */
.users-table .btn-small {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 28px;
    margin: 1px;
    border-radius: 4px;
}

.users-table .btn-edit {
    background: #059669 !important;
    color: white !important;
    border: 1px solid #047857 !important;
    font-weight: 500;
}

.users-table .btn-edit:hover {
    background: #047857 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

.users-table .btn-danger {
    background: #dc2626 !important;
    color: white !important;
    border: 1px solid #b91c1c !important;
    font-weight: 500;
}

.users-table .btn-danger:hover {
    background: #b91c1c !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.users-table .btn-warning {
    background: #f59e0b !important;
    color: white !important;
    border: 1px solid #d97706 !important;
    font-weight: 500;
}

.users-table .btn-warning:hover {
    background: #d97706 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Îmbunătățiri pentru status badges în tabel */
.users-table .status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Container pentru scroll orizontal pe mobile */
.users-table-container {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

.users-table-container::-webkit-scrollbar {
    height: 6px;
}

.users-table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.users-table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.users-table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive breakpoints */

/* Tablets (768px și mai mare) */
@media (min-width: 768px) {
    .logo {
        width: 100px;
    }
    
    .login-header h1 {
        font-size: 28px;
    }
    
    .login-form {
        padding: 40px;
    }
    
    .dashboard-main {
        flex-direction: row;
    }
    
    .sidebar {
        width: 250px;
        order: 1;
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu {
        flex-direction: column;
        padding: 24px 0;
        overflow-x: visible;
    }
    
    .nav-link {
        padding: 12px 24px;
        border-bottom: none;
    }
    
    .nav-link.active {
        border-bottom: none;
        border-right: 3px solid #4f46e5;
    }
    
    .content {
        order: 2;
        padding: 24px;
    }
    
    .content-section {
        padding: 24px;
    }
    
    .content-section h3 {
        font-size: 24px;
        margin-bottom: 24px;
    }
    
    .profile-form {
        grid-template-columns: 1fr 1fr;
        max-width: 800px;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .modal.active {
        align-items: center;
        padding-top: 0;
    }
    
    .modal-content {
        padding: 32px;
        max-width: 600px;
    }
    
    .modal-content h3 {
        font-size: 20px;
    }
    
    .users-table {
        display: table;
        font-size: 14px;
        margin-top: 24px;
    }
    
    .users-table th,
    .users-table td {
        padding: 16px 12px;
        min-width: auto;
    }
    
    /* Ajustări lățimi pentru tablete */
    .users-table th:nth-child(1),
    .users-table td:nth-child(1) {
        width: 10%;
    }
    
    .users-table th:nth-child(2),
    .users-table td:nth-child(2) {
        width: 20%;
    }
    
    .users-table th:nth-child(3),
    .users-table td:nth-child(3) {
        width: 25%;
    }
    
    .users-table .btn-small {
        padding: 6px 12px;
        font-size: 12px;
        min-height: 32px;
    }
}

/* Desktop (1024px și mai mare) */
@media (min-width: 1024px) {
    .logo {
        width: 120px;
    }
    
    .header-left h2 {
        font-size: 20px;
    }
    
    .logo-small {
        width: 40px;
        margin-right: 16px;
    }
    
    .modal-content {
        max-width: 800px;
    }
    
    .signature-canvas {
        width: 400px;
        height: 150px;
    }
    
    /* Îmbunătățiri tabel pentru ecrane largi */
    .users-table {
        font-size: 15px;
    }
    
    .users-table th,
    .users-table td {
        padding: 18px 16px;
    }
    
    .users-table .btn-small {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 36px;
        margin: 2px;
    }
}

/* Large screens (1280px și mai mare) */
@media (min-width: 1280px) {
    .content {
        padding: 32px;
    }
    
    .content-section {
        padding: 32px;
    }
    
    .profile-form {
        max-width: 1000px;
    }
}

/* Landscape orientation pe telefoane */
@media (max-height: 500px) and (orientation: landscape) {
    .login-container {
        padding: 10px;
    }
    
    .login-form {
        padding: 20px;
    }
    
    .logo {
        width: 60px;
        margin-bottom: 10px;
    }
    
    .login-header h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .dashboard-header,
    .users-actions,
    .signature-actions,
    .btn {
        display: none !important;
    }
    
    .content {
        padding: 0;
        background: white;
    }
    
    .content-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Stiluri specifice pentru butoanele pe mobile */
@media (max-width: 767px) {
    .user-card .btn {
        font-size: 14px !important;
        padding: 10px 12px !important;
        min-height: 44px !important; /* Apple recommended touch target size */
        border-radius: 6px !important;
        font-weight: 600 !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .user-card .btn-edit {
        background: #059669 !important;
        color: white !important;
        border: 2px solid #047857 !important;
    }
    
    .user-card .btn-edit:active {
        background: #047857 !important;
        transform: scale(0.98);
    }
    
    .user-card .btn-warning {
        background: #f59e0b !important;
        color: white !important;
        border: 2px solid #d97706 !important;
    }
    
    .user-card .btn-warning:active {
        background: #d97706 !important;
        transform: scale(0.98);
    }
    
    .user-card .btn-danger {
        background: #dc2626 !important;
        color: white !important;
        border: 2px solid #b91c1c !important;
    }
    
    .user-card .btn-danger:active {
        background: #b91c1c !important;
        transform: scale(0.98);
    }
    
    .user-card .btn.disabled {
        background: #d1d5db !important;
        color: #9ca3af !important;
        border: 2px solid #e5e7eb !important;
        cursor: not-allowed !important;
    }
}

/* Validation section styles */
.validation-section {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.validation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.validation-header h4 {
    margin: 0;
    color: #1f2937;
    font-size: 1.2rem;
}

.validation-list {
    max-height: 600px;
    overflow-y: auto;
}

.validation-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.validation-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.validation-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.validation-item-info h5 {
    margin: 0 0 4px 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.validation-item-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.validation-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.validation-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.validation-status.submitted {
    background-color: #dbeafe;
    color: #1e40af;
}

.validation-status.approved {
    background-color: #dcfce7;
    color: #166534;
}

.validation-status.rejected {
    background-color: #fee2e2;
    color: #dc2626;
}

.validation-details {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #4b5563;
}

.validation-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.validation-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.profile-preview {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    font-size: 0.9rem;
}

.profile-preview h6 {
    margin: 0 0 8px 0;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
}

.profile-field:last-child {
    border-bottom: none;
}

.profile-field-label {
    font-weight: 500;
    color: #6b7280;
}

.profile-field-value {
    color: #1f2937;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.validation-notes {
    margin-top: 12px;
}

.validation-notes textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    resize: vertical;
}

.waiting-indicator {
    font-size: 0.8rem;
    color: #ef4444;
    font-weight: 500;
}
