/* Custom CSS for Automatizaciones App */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* Progress bars */
.progress {
    height: 1rem;
    background-color: #e9ecef;
    border-radius: 0.5rem;
}

.progress-bar {
    border-radius: 0.5rem;
}

/* Forms */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    border-radius: 0.5rem;
}

/* Login/Register Pages */
.vh-100 {
    min-height: 100vh;
}

/* Dashboard specific styles */
.bg-primary {
    background: linear-gradient(135deg, #1F7A8C 0%, #022B3A 100%) !important;
}

.bg-header-primary {
    background: linear-gradient(135deg, #022B3A 0%, #1F7A8C 100%) !important;
}

.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Module cards */
.card.border-primary {
    border-color: var(--primary-color) !important;
}

.card.border-secondary {
    border-color: #6c757d !important;
}

.card.border-info {
    border-color: #0dcaf0 !important;
}

.card.border-success {
    border-color: var(--success-color) !important;
}

/* Status indicators */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Progress container */
.progress-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

/* Results table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
    overflow: hidden;
}

.results-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: none;
}

.results-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.results-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.results-table tr:hover {
    background-color: #e9ecef;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .display-1 {
        font-size: 3rem;
    }
    
    .display-4 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .h3 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {    
    .card-header {
        border-color: #404040;
    }
}

/* Custom alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0a3622;
}

.alert-danger {
    background-color: #f8d7da;
    color: #58151c;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

/* Footer */
footer {
    margin-top: auto;
    background-color: #f8f9fa !important;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Utility classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Session History - Lateral View Styles */
.session-container {
    position: relative;
    min-height: 70vh;
}

.full-view {
    width: 100%;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.full-view.slide-left {
    transform: translateX(-100%);
    opacity: 0;
}

.detail-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.detail-view.show {
    display: block !important;
    transform: translateX(0);
}

/* Sessions Sidebar */
.sessions-sidebar-list {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.session-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.session-item:hover {
    background-color: #f8f9fa;
}

.session-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.session-date {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.session-user {
    margin-bottom: 0.2rem;
}

.session-user small {
    font-size: 0.8rem;
    color: #6c757d;
}

.session-dates {
    margin-bottom: 0.4rem;
}

.session-dates small {
    font-size: 0.8rem;
    color: #6c757d;
}

.session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.session-type {
    font-size: 0.85rem;
    color: #6c757d;
}

.session-status {
    font-size: 0.8rem;
}

.session-status.success {
    color: #28a745;
}

.session-status.error {
    color: #dc3545;
}

.session-status.warning {
    color: #ffc107;
}

.session-status.secondary {
    color: #6c757d;
}

.session-results {
    font-size: 0.8rem;
    color: #17a2b8;
    font-weight: 500;
}

/* Session Details Table */
.session-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.session-details-table th {
    background: #f8f9fa;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.session-details-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.session-details-table tr:hover {
    background: #f0f0f0;
}

.expediente-description-col { 
    width: 55%; 
    font-weight: bold; 
    color: #2c3e50; 
}

.importe-col { 
    width: 15%; 
    text-align: right; 
    font-weight: bold; 
    color: #27ae60; 
}

.fecha-col { 
    width: 15%; 
    text-align: center; 
}

.acciones-col { 
    width: 15%; 
    text-align: center; 
}

.acciones-col .btn-group {
    display: flex;
    gap: 2px;
}

.acciones-col .btn-sm {
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
}

/* Responsive design for lateral view */
@media (max-width: 992px) {
    .detail-view .row.h-100 {
        flex-direction: column;
    }
    
    .detail-view .col-lg-4,
    .detail-view .col-lg-8 {
        flex: none;
        width: 100%;
        max-width: 100%;
    }
    
    .detail-view .col-lg-4 {
        height: 35vh;
    }
    
    .detail-view .col-lg-8 {
        height: 65vh;
    }
    
    .sessions-sidebar-list {
        max-height: 30vh;
    }    
}

@media (max-width: 768px) {
    .session-container {
        min-height: 60vh;
    }
    
    .detail-view .col-lg-4 {
        height: 30vh;
    }
    
    .detail-view .col-lg-8 {
        height: 60vh;
    }
    
    .sessions-sidebar-list {
        max-height: 25vh;
    }
    
    .session-item {
        padding: 0.5rem 0.75rem;
    }
    
    .session-date {
        font-size: 0.9rem;
    }

    .session-user small,
    .session-dates small {
        font-size: 0.75rem;
    }

    .session-type {
        font-size: 0.8rem;
    }
    
    /* Mobile-specific improvements */
    .session-details-table {
        font-size: 0.8rem;
    }
    
    .session-details-table th,
    .session-details-table td {
        padding: 8px 6px;
    }
    
    .expediente-description-col {
        width: 50%;
    }
    
    .importe-col {
        width: 20%;
    }
    
    .fecha-col {
        display: none;
    }
    
    .acciones-col {
        width: 30%;
    }
    
    .acciones-col .btn-group {
        flex-direction: column;
        gap: 1px;
    }
}

@media (max-width: 576px) {
    .session-container {
        min-height: 50vh;
    }
    
    .detail-view .col-lg-4 {
        height: 25vh;
    }
    
    .detail-view .col-lg-8 {
        height: 65vh;
    }
    
    .sessions-sidebar-list {
        max-height: 20vh;
    }
    
    .session-item {
        padding: 0.4rem 0.6rem;
    }
    
    .session-date {
        font-size: 0.85rem;
    }

    .session-user small,
    .session-dates small {
        font-size: 0.7rem;
    }

    .session-type {
        font-size: 0.75rem;
    }
    
    .session-results {
        font-size: 0.75rem;
    }
    
    /* Very small screens - simplified table */
    .session-details-table {
        font-size: 0.75rem;
    }
    
    .session-details-table th,
    .session-details-table td {
        padding: 6px 4px;
    }
    
    .expediente-description-col {
        width: 60%;
    }
    
    .importe-col,
    .fecha-col {
        display: none;
    }
    
    .acciones-col {
        width: 40%;
    }
    
    .acciones-col .btn-group {
        flex-direction: column;
        gap: 1px;
    }
    
    .acciones-col .btn-sm {
        padding: 0.2rem 0.3rem;
        font-size: 0.7rem;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .session-item {
        padding: 0.75rem 1rem;
        min-height: 3rem;
    }

    .session-item:active {
        background-color: #e3f2fd;
    }
}

/* Modal Z-Index Management for Nested Modals */
#deleteConfirmModal {
    z-index: 1070 !important;
}

#deleteConfirmModal.show ~ .modal-backdrop.show {
    z-index: 1069 !important;
}
