/* === DOLIBARR DASHBOARD THEME (BRANDED) === */
#dolibarr-dashboard {
  background: #f8fafc;
  width: 100%;
  display: flex;
  justify-content: center;
  min-height: 85vh;
  font-family: "Inter", "Poppins", sans-serif;
  padding: 40px 15px;
  transition: background 0.3s ease, color 0.3s ease;
  border-radius: 30px;
}

#dolibarr-dashboard * {
  box-sizing: border-box;
  color: #1e293b;
  transition: all 0.3s ease;
}

/* === LIGHT / DARK MODE TOGGLE === */
#theme-toggle {
  position: absolute;
  top: 15px;
  right: 25px;
  background: #FD8127;
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
#theme-toggle:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* === CONTAINER === */
.dashboard-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  position: relative;
}

/* === WELCOME CARD === */
.welcome-card {
  text-align: center;
  background: #fff;
  padding: 35px 25px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.welcome-card h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #245F95;
}
.welcome-card p {
  color: #475569;
  margin-top: 8px;
}

/* === PROFILE SECTION === */
#profile-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 30px 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  max-width: 600px;
  margin: 0 auto;
}

#profile-section h2 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  color: #245F95;
  margin-bottom: 25px;
}

/* === PROFILE FORM === */
#profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#profile-form label {
  font-weight: 600;
  color: #334155;
  font-size: 0.95rem;
}

#profile-form input {
  background: #f9fafb;
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
  border-radius: 8px;
  color: #111827;
  font-size: 1rem;
  transition: border 0.2s, background 0.2s;
}

#profile-form input:focus {
  outline: none;
  border-color: #245F95;
  background: #fff;
}

input[readonly] {
  background: #f1f5f9;
  cursor: not-allowed;
  color: #64748b;
}

#profile-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

#profile-buttons button {
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#edit-profile {
  background: #245F95;
  color: #fff;
}

#save-profile {
  background: #FD8127;
  color: white;
}
#save-profile:hover {
  background: #e46e15;
}

#cancel-edit {
  background: #64748b;
  color: white;
}
#cancel-edit:hover {
  background: #475569;
}

#profile-status {
  text-align: center;
  margin-top: 15px;
  font-size: 0.95rem;
}

/* === STATS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
}
.stat-card h3 {
  font-size: 1.1rem;
  color: #245F95;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-card p {
  font-size: 1.4rem;
  font-weight: 700;
  color: #FD8127;
}

/* === QUICK LINKS === */
.links-section {
  text-align: center;
}
.links-section h2 {
  color: #245F95;
  margin-bottom: 20px;
  font-size: 1.5rem;
}
.links-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}
.link-btn {
  background: #245F95 ;
  color: #fff !important;
  text-decoration: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.2s ease, opacity 0.3s ease;
}
.link-btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* === DOCUMENTS SECTION === */
.documents-section {
  background: #fff;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
}
.documents-section h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #245F95;
  margin-bottom: 20px;
}

.upload-box {
  margin-bottom: 20px;
  text-align: center;
}

.upload-btn {
  background: #FD8127;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  transition: all 0.2s ease;
}
.upload-btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.upload-status {
  margin-top: 8px;
  color: #475569;
  font-size: 0.9rem;
}

.documents-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.documents-list li {
  background: #f9fafb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}
.documents-list li:hover {
  background: #f1f5f9;
}
.doc-link {
  color: #FD8127 !important;
  text-decoration: underline;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
}

/* === DARK MODE === */
.dark-mode #dolibarr-dashboard {
  background: #0b132b;
  color: #f1f5f9;
}
.dark-mode #dolibarr-dashboard * {
  color: #f1f5f9;
}
.dark-mode #dolibarr-dashboard .welcome-card,
.dark-mode #dolibarr-dashboard #profile-section,
.dark-mode #dolibarr-dashboard .stat-card,
.dark-mode #dolibarr-dashboard .documents-section {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: none;
}
.dark-mode #dolibarr-dashboard input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}
.dark-mode #dolibarr-dashboard .doc-link {
  color: #FD8127 !important;
}
/* Fix document visibility in dark mode */
.dark-mode #dolibarr-dashboard .documents-list li {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
}

.dark-mode #dolibarr-dashboard .documents-list li span {
  color: #fff;
}
.dark-mode #dolibarr-dashboard .doc-link {
  color: #FD8127 !important;
}

/* === TICKETS SECTION === */
.tickets-section {
  background: #fff;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
  margin-top: 20px;
}
.tickets-section h2 {
  color: #245F95;
  font-size: 1.4rem;
}

.create-ticket-btn {
  background: #FD8127;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  cursor: pointer;
  font-weight: 600;
  border: none;
}

.tickets-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tickets-list li {
  background: #f9fafb;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
}

.ticket-card {
  background: #fff;
  padding: 15px;
  margin: 10px 0;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
}

.ticket-card h3 {
  margin-top: 0;
  color: #245F95;
}

.view-ticket-btn {
  background: #245F95;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 600;
}

.ticket-status {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.status-new { background: #dbeafe; color:#1e40af; }
.status-progress { background: #fff7cd; color:#b45309; }
.status-resolved { background: #dcfce7; color:#166534; }
.status-closed { background: #e2e8f0; color:#475569; }

/* === TICKET MODAL === */
.ticket-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}

.ticket-modal.hidden { display: none; }

.ticket-modal-content {
  background: #fff;
  padding: 25px;
  width: 480px;
  max-width: 90%;
  border-radius: 16px;
  animation: fadeInUp .25s ease;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

@keyframes fadeInUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

#closeTicketModal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  cursor: pointer;
  color: #666;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
  #dolibarr-dashboard {
    padding: 20px 10px;
  }
  .link-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  #profile-section {
    padding: 20px;
  }
  .ticket-modal-content {
    padding: 20px;
    width: 95%;
  }
}
/* === CREATE TICKET MODAL === */
.create-ticket-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000000;
    backdrop-filter: blur(4px);
}

.create-ticket-modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.create-ticket-header {
    text-align: center;
    margin-bottom: 32px;
}

.create-ticket-header .header-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #245F95 0%, #2D7BC1 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.create-ticket-header h2 {
    color: #245F95;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
}

.create-ticket-header p {
    color: #64748b;
    font-size: 16px;
    margin: 0;
}

.create-ticket-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #334155;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #245F95;
    box-shadow: 0 0 0 3px rgba(36, 95, 149, 0.1);
}

.form-group input[readonly] {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.form-buttons button {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-btn {
    background: linear-gradient(135deg, #FD8127 0%, #FF9A3D 100%);
    color: white;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(253, 129, 39, 0.3);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.cancel-btn {
    background: #f1f5f9;
    color: #64748b;
}

.cancel-btn:hover {
    background: #e2e8f0;
}

.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === NOTIFICATION STYLES === */
.ticket-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000001;
    transform: translateX(120%);
    transition: transform 0.3s ease-out;
    max-width: 400px;
}

.ticket-notification.show {
    transform: translateX(0);
}

.ticket-notification.success {
    border-left: 4px solid #10b981;
}

.ticket-notification.error {
    border-left: 4px solid #ef4444;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.ticket-notification.success .notification-icon {
    background: #dcfce7;
    color: #10b981;
}

.ticket-notification.error .notification-icon {
    background: #fee2e2;
    color: #ef4444;
}

.notification-content strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.notification-content p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* === DARK MODE SUPPORT === */
.dark-mode .create-ticket-modal-content {
    background: #1e293b;
    color: #f1f5f9;
}

.dark-mode .create-ticket-header h2 {
    color: #f1f5f9;
}

.dark-mode .create-ticket-header p {
    color: #cbd5e1;
}

.dark-mode .form-group label {
    color: #e2e8f0;
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.dark-mode .form-group input[readonly] {
    background: #475569;
}

.dark-mode .cancel-btn {
    background: #475569;
    color: #cbd5e1;
}

.dark-mode .cancel-btn:hover {
    background: #4b5563;
}

.dark-mode .close-btn:hover {
    background: #475569;
}

.dark-mode .ticket-notification {
    background: #334155;
    color: #f1f5f9;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .create-ticket-modal-content {
        width: 95%;
        padding: 24px;
        border-radius: 20px;
    }
    
    .create-ticket-header h2 {
        font-size: 24px;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .ticket-notification {
        left: 16px;
        right: 16px;
        max-width: none;
    }
}
/* === TICKET VIEW TOGGLE === */
#ticketViewToggle {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.toggle-buttons {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 2px;
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    white-space: nowrap;
}

.toggle-btn.active {
    background: #245F95;
    color: white;
    box-shadow: 0 2px 4px rgba(36, 95, 149, 0.2);
}

.toggle-btn:hover:not(.active) {
    background: #e2e8f0;
}

.ticket-count-badge {
    background: #FD8127;
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-left: auto;
}

/* === TICKET CARD STYLES === */
.ticket-card {
    background: #fff;
    padding: 20px;
    margin: 10px 0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.ticket-ref {
    margin: 0 0 8px 0;
    color: #245F95;
    font-size: 18px;
    font-weight: 700;
}

.ticket-subject {
    margin: 0;
    font-weight: 600;
    color: #334155;
    font-size: 16px;
}

.ticket-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.ticket-detail {
    display: flex;
    flex-direction: column;
}

.ticket-detail small {
    color: #64748b;
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: 500;
}

.ticket-detail span {
    color: #334155;
    font-weight: 500;
}

.ticket-status {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

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

.status-progress {
    background: #fef3c7;
    color: #b45309;
}

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

.view-ticket-btn {
    margin-top: 16px;
    background: #245F95;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
    font-size: 14px;
}

.view-ticket-btn:hover {
    background: #1e4f80;
}

/* Dark mode support */
.dark-mode #ticketViewToggle {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.dark-mode .ticket-card {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.dark-mode .toggle-buttons {
    background: rgba(255,255,255,0.1);
}

.dark-mode .toggle-btn:not(.active) {
    color: #cbd5e1;
}

.dark-mode .toggle-btn.active {
    background: #245F95;
    color: white;
}

.dark-mode .toggle-btn:hover:not(.active) {
    background: rgba(255,255,255,0.2);
}

.dark-mode .ticket-ref {
    color: #60a5fa;
}

.dark-mode .ticket-subject {
    color: #e2e8f0;
}

.dark-mode .ticket-detail small {
    color: #94a3b8;
}

.dark-mode .ticket-detail span {
    color: #e2e8f0;
}

.dark-mode .view-ticket-btn:hover {
    background: #1e4f80;
}
/* === TICKET VIEW TOGGLE === */
.toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: #245F95;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: #e2e8f0;
}

.ticket-view-toggle {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ticket-count-badge {
    background: #FD8127;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

/* Update ticket cards for better layout */
.ticket-card {
    background: #fff;
    padding: 20px;
    margin: 10px 0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Dark mode support */
.dark-mode .ticket-card {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.dark-mode .toggle-btn:not(.active) {
    background: rgba(255,255,255,0.1);
    color: #cbd5e1;
}

.dark-mode .toggle-btn.active {
    background: #245F95;
    color: white;
}

.dark-mode .ticket-count-badge {
    background: #FD8127;
}
/* Responsive */
@media (max-width: 640px) {
    #ticketViewToggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ticket-count-badge {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .ticket-card-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .ticket-details {
        grid-template-columns: 1fr;
    }
}