/* Koaloo Admin - Styles entièrement responsive */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.logo-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 12px;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

#associate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-item {
    color: #64748b;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Navigation */
.nav {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs {
    display: flex;
    gap: 0;
    min-width: max-content;
}

.nav-tab {
    background: none;
    border: none;
    padding: 16px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-tab:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.nav-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: #f8fafc;
}

.nav-tab i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.chart-card canvas {
    max-height: 300px;
    width: 100% !important;
    height: auto !important;
}

/* Members */
.members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.member-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.member-avatar {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-role {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-shares {
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.9rem;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.close {
    color: #64748b;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #64748b;
    font-style: italic;
}

/* Settings */
.settings-form {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    max-width: 500px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
    max-width: calc(100vw - 40px);
    word-wrap: break-word;
}

.notification.success {
    background: #10b981;
}

.notification.error {
    background: #ef4444;
}

.notification.info {
    background: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utilities */
.no-data {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 2rem;
}

.error {
    color: #ef4444;
    text-align: center;
    padding: 2rem;
}

/* Overlay pour changement de mot de passe */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.password-overlay-content {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.password-overlay-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.password-overlay-header p {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.password-overlay-message {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
}

.password-overlay-message i {
    font-size: 1.5rem;
    color: #f59e0b;
    margin-top: 0.25rem;
}

.password-overlay-message p {
    color: #92400e;
    margin: 0;
    line-height: 1.6;
}

.password-overlay-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .members-list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .password-overlay-content {
        padding: 2rem 1.5rem;
    }
    
    .password-overlay-header h2 {
        font-size: 1.5rem;
    }
    
    .password-overlay-message {
        padding: 1rem;
    }
    
    .btn-large {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-center {
        position: static;
        transform: none;
        text-align: center;
        order: 2;
    }
    
    .logo {
        justify-content: center;
    }
    
    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-tabs {
        justify-content: flex-start;
    }
    
    .nav-tab {
        padding: 12px 16px;
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .nav-tab i {
        font-size: 1.1rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .members-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .member-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .member-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .member-info h4 {
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
    }
    
    .member-role {
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
    }
    
    .member-actions {
        justify-content: center;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-width: none;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .settings-form {
        max-width: none;
        width: 100%;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .chart-card {
        padding: 1rem;
    }
    
    .chart-card canvas {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .logo-image {
        width: 40px;
        height: 40px;
    }
    
    .nav-tab {
        padding: 10px 12px;
        gap: 4px;
    }
    
    .nav-tab i {
        font-size: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .member-card {
        padding: 0.75rem;
    }
    
    .ticket-card {
        padding: 0.75rem;
    }
    
    .ticket-type-icon {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
    
    .ticket-message {
        font-size: 0.95rem;
    }
    
    .ticket-member-name {
        font-size: 0.9rem;
    }
    
    .ticket-date {
        font-size: 0.8rem;
    }
    
    .member-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .modal-content {
        margin: 1% auto;
        width: 98%;
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .chart-card {
        padding: 0.75rem;
    }
    
    .chart-card canvas {
        max-height: 200px;
    }
    
    .ticket-card {
        padding: 1rem;
    }
    
    .ticket-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ticket-status-badge {
        align-self: flex-start;
    }
    
    .ticket-body {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .ticket-type-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .ticket-message {
        font-size: 1rem;
    }
    
    .ticket-actions {
        flex-direction: column;
    }
    
    .ticket-actions .btn {
        width: 100%;
    }
}

/* Small devices (320px - 480px) */
@media (max-width: 480px) {
    .header {
        padding: 0.75rem 0;
    }
    
    .header-content {
        gap: 0.75rem;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .user-name {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .nav-tab {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .nav-tab i {
        font-size: 0.9rem;
    }
    
    .main {
        padding: 0.75rem 0;
    }
    
    .container {
        padding: 0 10px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main {
        padding: 0.5rem 0;
    }
    
    .page-header {
        margin-bottom: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.5rem;
    }
    
    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .chart-card canvas {
        max-height: 150px;
    }
}

/* Tickets */
.tickets-list {
    display: grid;
    gap: 1rem;
}

.ticket-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-member-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.ticket-member-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-date {
    color: #64748b;
    font-size: 0.85rem;
}

.ticket-status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.ticket-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.ticket-status-badge.approved {
    background: #dcfce7;
    color: #16a34a;
}

.ticket-status-badge.rejected {
    background: #fee2e2;
    color: #dc2626;
}

.ticket-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.ticket-type-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.ticket-type-icon.deposit {
    background: #dbeafe;
}

.ticket-type-icon.request {
    background: #fef3c7;
}

.ticket-content {
    flex: 1;
    min-width: 0;
}

.ticket-message {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
    word-wrap: break-word;
}

.ticket-type-label {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ticket-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.ticket-proposals {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.ticket-proposals h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.75rem;
}

.proposal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.proposal-item.pending {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
}

.proposal-item.approved {
    background: #dcfce7;
    border-left: 3px solid #16a34a;
}

.proposal-item.rejected {
    background: #fee2e2;
    border-left: 3px solid #dc2626;
}

.proposer-name {
    font-weight: 500;
    color: #1e293b;
    flex: 1;
    min-width: 0;
}

.proposal-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.proposal-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.proposal-status.approved {
    background: #dcfce7;
    color: #16a34a;
}

.proposal-status.rejected {
    background: #fee2e2;
    color: #dc2626;
}

.proposal-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Print styles */
@media print {
    .header,
    .nav,
    .btn,
    .modal,
    .notification {
        display: none !important;
    }
    
    .main {
        padding: 0;
    }
    
    .stat-card,
    .member-card,
    .chart-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}