* {
    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;
}

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

.login-container h1 {
    color: white;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #5a6fd8;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    margin-top: 1rem;
    text-align: center;
}

/* Navbar */
.navbar {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-brand:hover {
    color: #667eea;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-user-text {
    color: #666;
    margin-right: 0.5rem;
}

.btn-nav {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
}

.btn-nav:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

#btn-reorder.active {
    background: #28a745;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container h1 {
    color: white;
    margin-bottom: 2rem;
    text-align: center;
}

/* Subdomains List */
.subdomains-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.site-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
    position: relative;
}

.site-item:last-child {
    border-bottom: none;
}

.site-item:hover {
    background-color: #f8f9fa;
}

.status-active {
    background: #28a745;
}

.status-inactive {
    background: #6c757d;
}

.site-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.site-details {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.site-folder {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.folder-path {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.folder-path::-webkit-scrollbar {
    display: none;
}

/* Drawer que empuja contenido */
.site-drawer {
    display: none;
    grid-column: 1 / -1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 1.5rem;
    margin: 0 -2rem -1.5rem -2rem;
    width: calc(100% + 4rem);
    position: static;
    z-index: 1;
    animation: drawerSlideDown 0.3s ease-out;
}

.site-item.drawer-open {
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background-color: #f8f9fa !important;
    margin-bottom: 0;
}

.drawer-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Tarjeta principal "Abrir Sitio" */
.drawer-main-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: #007bff;
    transition: all 0.3s ease;
    height: 120px;
    text-align: center;
}

.drawer-main-card:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.main-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.main-card-text {
    font-weight: 600;
    font-size: 1rem;
}

/* Grid de acciones */
.drawer-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.drawer-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem 0.5rem;
    text-decoration: none;
    color: #495057;
    transition: all 0.2s ease;
    min-height: 80px;
    text-align: center;
}

.drawer-action:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.drawer-action.placeholder {
    background: transparent;
    border: 2px dashed #dee2e6;
    cursor: default;
}

.drawer-action.placeholder:hover {
    background: transparent;
    color: #495057;
    border-color: #dee2e6;
    transform: none;
    box-shadow: none;
}

.action-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.action-text {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
}

/* Modo reordenar */
.reorder-mode .site-item {
    cursor: move;
    background-color: #f8f9fa !important;
    border-left: 3px solid #28a745;
}

.site-item.dragging {
    opacity: 0.5;
    background-color: #e9ecef !important;
}

.reorder-mode .drag-handle {
    display: block;
}

/* Estilos para formulario de agregar sitio */
.card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

.card-header {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #dee2e6;
}

.card-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.card-body {
    padding: 2rem;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.form-input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.input-with-suffix {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.input-with-suffix:focus-within {
    border-color: #667eea;
}

.input-with-suffix .form-input {
    border: none;
    border-radius: 0;
    flex: 1;
}

.input-suffix {
    background: #f8f9fa;
    padding: 12px 16px;
    color: #666;
    border-left: 1px solid #ddd;
    font-size: 14px;
    white-space: nowrap;
}

.form-help {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin-bottom: 1.5rem;
}

.info-box {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 5px;
    padding: 1.5rem;
}

.info-title {
    color: #0c5460;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.info-list {
    color: #0c5460;
    margin: 0;
    padding-left: 1.5rem;
}

.info-list li {
    margin-bottom: 0.5rem;
}

.info-link {
    color: #0056b3;
    text-decoration: underline;
    transition: color 0.3s;
}

.info-link:hover {
    color: #003d7a;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

/* Animaciones */
@keyframes drawerSlideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 300px;
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .drawer-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .navbar {
        padding: 1rem;
    }

    .nav-user-text {
        display: none;
    }

    .site-item {
        padding: 1rem;
        gap: 0.75rem;
    }

    .site-info {
        min-width: 0;
    }

    .site-name {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-details {
        flex-direction: column;
        gap: 0.25rem;
    }

    .site-folder strong {
        display: none;
    }

    .folder-path {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 2px 0;
    }

    .drawer-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .drawer-main-card {
        height: 100px;
        padding: 1rem;
    }

    .drawer-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-card-icon {
        font-size: 1.5rem;
    }

    .main-card-text {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    .card-header {
        padding: 1rem 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .input-with-suffix {
        flex-direction: column;
    }

    .input-suffix {
        border-left: none;
        border-top: 1px solid #ddd;
        width: 100%;
        text-align: center;
    }

    .reorder-mode .site-item {
        touch-action: none;
    }

    .site-item.dragging {
        opacity: 0.8;
        background-color: #e9ecef !important;
        transition: transform 0.2s ease;
    }
}

@media (max-width: 480px) {
    .drawer-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .drawer-action {
        min-height: 70px;
        padding: 0.75rem 0.25rem;
    }

    .action-icon {
        font-size: 1.25rem;
    }

    .action-text {
        font-size: 0.75rem;
    }

    .navbar {
        padding: 0.5rem;
    }

    .nav-brand {
        font-size: 1.25rem;
    }
}

/* Contenedor unificado para status SSL y drag handle */
.status-handle-container {
    width: 32px; /* Ancho fijo */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

/* Status SSL - visible por defecto */
.status-handle-container .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 0.2s, opacity 0.2s;
    position: static; /* Quitar posición absoluta */
}

.status-handle-container .status-indicator:hover {
    transform: scale(1.3);
}

/* Drag handle - oculto por defecto */
.status-handle-container .drag-handle {
    display: none;
    cursor: grab;
    color: #6c757d;
    font-weight: bold;
    user-select: none;
    font-size: 16px;
}

.status-handle-container .drag-handle:active {
    cursor: grabbing;
}

/* Modo reordenar - alternar visibilidad */
.reorder-mode .status-handle-container .status-indicator {
    display: none;
}

.reorder-mode .status-handle-container .drag-handle {
    display: block;
}