/* Styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    display: inline-block;
    margin-right: 2rem;
}

header nav {
    display: inline-block;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

header nav a:hover,
header nav a.active {
    background-color: rgba(255,255,255,0.2);
}

/* Main content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-weight: 500;
}

/* Content grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

/* Cards */
.card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2 i {
    color: #667eea;
}

/* List */
.list {
    margin-bottom: 1.5rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s;
}

.list-item:hover {
    background-color: #f8f9fa;
}

.item-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.item-info p {
    color: #666;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background: #5a6fd8;
}

.btn-primary {
    background: #28a745;
}

.btn-primary:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Plan de bâtiment */
.plan-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.plan-canvas {
    border: 2px solid #ddd;
    border-radius: 5px;
    background: #f8f9fa;
    position: relative;
    margin: 0 auto;
    cursor: crosshair;
}

.equipment-icon {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    cursor: grab;
    transition: transform 0.3s;
    z-index: 10;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transform-origin: center center;
    user-select: none;
}

.equipment-icon.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.equipment-icon:hover {
    transform: scale(1.2);
    cursor: grab;
}

.equipment-icon:hover::after {
    content: "Déplacer";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
}

.equipment-icon.imprimante {
    background: #ff6b6b;
}

.equipment-icon.telephone {
    background: #4ecdc4;
}

.equipment-icon.pc {
    background: #45b7d1;
}

.equipment-icon.serveur {
    background: #96ceb4;
}

.equipment-icon.routeur {
    background: #feca57;
}

.equipment-icon.autre {
    background: #a55eea;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip.show {
    opacity: 1;
}

/* 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: 2% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #000;
}

/* Equipment list */
.equipment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.equipment-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.equipment-card h4 {
    color: #333;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equipment-card .status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.equipment-card .status.actif {
    background: #d4edda;
    color: #155724;
}

.equipment-card .status.inactif {
    background: #f8d7da;
    color: #721c24;
}

.equipment-card .status.maintenance {
    background: #fff3cd;
    color: #856404;
}

.equipment-card p {
    color: #666;
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

/* Alert messages */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Concession info */
.concession-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.concession-info p {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.concession-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.stat-item {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.stat-item h4 {
    color: #333;
    margin-bottom: 1rem;
}

.stat-details p {
    margin-bottom: 0.5rem;
}

.stat-actif {
    color: #28a745;
}

.stat-inactif {
    color: #dc3545;
}

.stat-maintenance {
    color: #ffc107;
}

/* Equipment grid */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.equipment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Current plan info */
.current-plan {
    background: #e9ecef;
    padding: 1rem;
    border-radius: 5px;
    margin-top: 0.5rem;
}

.current-plan p {
    margin-bottom: 0.5rem;
}

.current-plan p:last-child {
    margin-bottom: 0;
}

/* Plan canvas with background image */
.plan-canvas {
    border: 2px solid #ddd;
    border-radius: 5px;
    background: #f8f9fa;
    position: relative;
    margin: 0 auto;
    cursor: grab;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform-origin: center center;
    transition: transform 0.1s ease;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Plan canvas */
#planCanvas{
    width: 1127px !important;
}

.plan-canvas.has-background {
    background-color: white;
}

.plan-canvas.dragging {
    cursor: grabbing;
}

.plan-canvas.zoomed {
    cursor: grab;
}

/* Plan container pour occuper toute la page */
.plan-container {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Mode plein écran */
.plan-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    padding: 0.5rem;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

/* Contrôles de zoom */
.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 60px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.fullscreen-btn:hover {
    background: white;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.zoom-btn:hover {
    background: white;
}

.zoom-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 100;
}

.help-text {
    color: #666;
    font-size: 0.9rem;
    margin-right: 1rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .plan-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .plan-header h2 {
        font-size: 1.2rem;
    }
    
    .help-text {
        font-size: 0.8rem;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .zoom-controls {
        top: 5px;
        right: 5px;
    }
    
    .zoom-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .zoom-info {
        top: 5px;
        left: 5px;
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .equipment-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    header h1 {
        display: block;
        margin-bottom: 1rem;
    }
    
    header nav {
        display: block;
    }
    
    .concession-actions {
        flex-direction: column;
    }
    
    .equipment-actions {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
