/* Custom CSS for OpenVPN Manager */

/* Tooltip styling */
.tooltip-inner {
    background-color: #32363A !important;
    padding: 0.6em;
    /*!important is not necessary if you place custom.css at the end of your css calls. For the purpose of this demo, it seems to be required in SO snippet*/
}

/* User row styling for better readability */
.user-row-even {
    background: rgba(255, 255, 255, 0.02);
}

.user-row-odd {
    background: rgba(255, 255, 255, 0.05);
}

.user-main-row {
    border: none !important;
}

.user-main-row td {
    border-bottom: none !important;
    border-top: none !important;
}

.user-groups-row {
    border: none !important;
}

.user-groups-row td {
    border-bottom: none !important;
    border-top: none !important;
}

/* Add separator only between different users */
.user-groups-row:not(:last-child) {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}

.user-groups-cell {
    padding: 15px 12px !important;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.01) 0%, 
        rgba(255, 255, 255, 0.03) 100%);
}

.user-row-border-start {
    border-left: 3px solid rgba(0, 212, 170, 0.3) !important;
}

.user-row-border-end {
    border-right: 3px solid rgba(0, 212, 170, 0.3) !important;
}

.user-row-border-top {
    border-top: 3px solid rgba(0, 212, 170, 0.3) !important;
}

.user-row-border-bottom {
    border-bottom: 3px solid rgba(0, 212, 170, 0.3) !important;
}

/* Hover effects - triggered by JavaScript */
.user-section-hover {
    background: rgba(0, 212, 170, 0.08) !important;
    transition: all 0.2s ease;
}

.user-section-hover .user-row-border-start,
.user-section-hover .user-row-border-end {
    border-color: rgba(0, 212, 170, 0.7) !important;
    border-width: 4px !important;
    transition: all 0.2s ease;
}

/* Only highlight top border on main row and bottom border on groups row during hover */
.user-section-hover.user-main-row .user-row-border-top {
    border-color: rgba(0, 212, 170, 0.7) !important;
    border-width: 4px !important;
    transition: all 0.2s ease;
}

.user-section-hover.user-groups-row .user-row-border-bottom {
    border-color: rgba(0, 212, 170, 0.7) !important;
    border-width: 4px !important;
    transition: all 0.2s ease;
}

/* Badge improvements */
.badge.rounded-pill {
    margin: 0 2px 2px 0;
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Layout improvements */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.btn-modern {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-modern:active {
    transform: translateY(0);
}

.btn-primary-modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-primary-modern:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-secondary-modern {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary-modern:hover {
    background: linear-gradient(135deg, #5a6268 0%, #3d4142 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-warning-modern {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-warning-modern:hover {
    background: linear-gradient(135deg, #ee82ee 0%, #ff69b4 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.btn-success-modern {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-success-modern:hover {
    background: linear-gradient(135deg, #0d7377 0%, #2dd4bf 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-danger-modern {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-danger-modern:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #dd2c00 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.info-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.info-icon.primary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    color: #667eea;
}

.info-icon.success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.2) 0%, rgba(56, 239, 125, 0.2) 100%);
    color: #11998e;
}

.info-icon.warning {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.2) 0%, rgba(245, 87, 108, 0.2) 100%);
    color: #f093fb;
}

.info-icon.secondary {
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.2) 0%, rgba(73, 80, 87, 0.2) 100%);
    color: #6c757d;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-indicator.status-active {
    background: rgba(17, 153, 142, 0.2);
    color: #11998e;
    border: 1px solid rgba(17, 153, 142, 0.3);
}

.status-indicator.status-inactive {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.status-indicator.status-warning {
    background: rgba(240, 147, 251, 0.2);
    color: #f093fb;
    border: 1px solid rgba(240, 147, 251, 0.3);
}

.status-indicator.status-danger {
    background: rgba(255, 65, 108, 0.2);
    color: #ff416c;
    border: 1px solid rgba(255, 65, 108, 0.3);
}

.status-indicator.status-info {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.table-modern {
    background: transparent;
}

.table-modern th {
    border-top: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    padding: 1rem 0.75rem;
}

.table-modern td {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.alert-modern {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.alert-modern.alert-info {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.alert-modern.alert-warning {
    background: rgba(240, 147, 251, 0.1);
    border-color: rgba(240, 147, 251, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.alert-modern.alert-danger {
    background: rgba(255, 65, 108, 0.1);
    border-color: rgba(255, 65, 108, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.alert-modern.alert-success {
    background: rgba(17, 153, 142, 0.1);
    border-color: rgba(17, 153, 142, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* Certificate tiles scroll styling */
.certificate-tiles-container {
    max-height: 400px;
    overflow-y: auto;
}

.certificate-tiles-container::-webkit-scrollbar {
    width: 8px;
}

.certificate-tiles-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.certificate-tiles-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.certificate-tiles-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Sidebar styling */
.sidebar {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    color: white;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Form styling improvements */
.form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    color: white;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
}

.form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    color: white;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-check-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Error pages styling */
.error-icon {
    background: var(--gradient-primary);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    font-size: 4rem;
    color: white;
}

.error-icon.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.error-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.floating-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.floating-element {
    position: absolute;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-element:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.floating-element:nth-child(3) {
    bottom: 20%;
    left: 30%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* Error pages body override for centering */
body.error-page {
    display: flex;
    align-items: center;
}

/* Modal styling */
.modal-content-glass {
    background: rgba(26, 31, 58, 0.95) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Glass card header */
.glass-card-header {
    background: rgba(255, 255, 255, 0.02);
}

/* Analytics specific styling */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container canvas {
    max-height: 100%;
}

.analytics-metric {
    transition: transform 0.2s ease;
}

.analytics-metric:hover {
    transform: translateY(-2px);
}

.progress-modern {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-modern .progress-bar {
    background: linear-gradient(135deg, #00d4aa 0%, #7c3aed 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .user-row-border-start,
    .user-row-border-end {
        border-width: 2px !important;
    }
    
    .user-section-hover .user-row-border-start,
    .user-section-hover .user-row-border-end {
        border-width: 3px !important;
    }
    
    /* Analytics mobile optimizations */
    .chart-container {
        height: 250px;
    }
    
    .analytics-metric h4 {
        font-size: 1.5rem;
    }
    
    .info-grid .glass-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 200px;
    }
    
    .analytics-metric h4 {
        font-size: 1.25rem;
    }
    
    .analytics-metric h6 {
        font-size: 0.875rem;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Certificate action buttons */
.btn-outline-success {
    color: #00d4aa;
    border-color: #00d4aa;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-outline-success:hover {
    background-color: #00d4aa;
    border-color: #00d4aa;
    color: #1a1a1a;
    transform: translateY(-1px);
}

.btn-outline-success:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 212, 170, 0.25);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Certificate status indicators */
.cert-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.cert-status-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a1a;
}

.cert-status-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.cert-status-success {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: white;
}

/* Compact button improvements */
.btn-outline-warning {
    border-color: rgba(245, 158, 11, 0.5);
    color: #f59e0b;
}

.btn-outline-warning:hover {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #1a1a1a;
}

.btn-outline-primary {
    border-color: rgba(14, 165, 233, 0.5);
    color: #0ea5e9;
}

.btn-outline-primary:hover {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
    color: white;
}

/* Prominent refresh buttons */
.btn-prominent {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: #1a1a1a;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: all 0.3s ease;
    animation: gentlePulse 2s ease-in-out infinite;
}

.btn-prominent:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    animation: none;
}

.btn-pulse {
    animation: buttonPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
}

.btn-pulse:hover {
    animation: none;
}

@keyframes gentlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    }
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Warning status enhancement */
.status-indicator.status-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    border: 1px solid rgba(245, 158, 11, 0.3);
    animation: warningGlow 2s ease-in-out infinite alternate;
}

@keyframes warningGlow {
    from {
        border-color: rgba(245, 158, 11, 0.3);
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    }
    to {
        border-color: rgba(245, 158, 11, 0.5);
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.3));
    }
}

/* Prominent download buttons */
.btn-prominent-download {
    background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
    transition: all 0.3s ease;
    animation: gentleGlow 3s ease-in-out infinite;
}

.btn-prominent-download:hover {
    background: linear-gradient(135deg, #00b894 0%, #009c7a 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
    animation: none;
}

.btn-download-glow {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    color: white;
    animation: downloadPulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.6);
}

.btn-download-glow:hover {
    background: linear-gradient(135deg, #00b894, #009c7a);
    color: white;
    animation: none;
}

@keyframes gentleGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 16px rgba(0, 212, 170, 0.4);
    }
}

@keyframes downloadPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.6);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(0, 212, 170, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0);
    }
}

/* Success status enhancement */
.status-indicator.status-active {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.2), rgba(0, 184, 148, 0.2));
    border: 1px solid rgba(0, 212, 170, 0.3);
    animation: successGlow 3s ease-in-out infinite alternate;
}

@keyframes successGlow {
    from {
        border-color: rgba(0, 212, 170, 0.3);
        background: linear-gradient(135deg, rgba(0, 212, 170, 0.2), rgba(0, 184, 148, 0.2));
    }
    to {
        border-color: rgba(0, 212, 170, 0.4);
        background: linear-gradient(135deg, rgba(0, 212, 170, 0.25), rgba(0, 184, 148, 0.25));
    }
}