/* Custom CSS for all pages with theme support and rounded containers */

/* Global rounded containers */
.card {
    border-radius: 1.5rem !important;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.125));
    background-color: var(--body-bg, #ffffff);
    transition: all 0.3s ease;
}

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

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Rounded form elements */
.form-control,
.form-select {
    border-radius: 1rem !important;
    border: 2px solid var(--border-color, #dee2e6);
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color, #1d7cba);
    box-shadow: 0 0 0 0.2rem rgba(29, 124, 186, 0.25);
    border-radius: 1rem !important;
}

/* Rounded buttons */
.btn {
    border-radius: 0.75rem !important;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-sm {
    border-radius: 0.5rem !important;
    padding: 0.375rem 1rem;
}

.btn-lg {
    border-radius: 1rem !important;
    padding: 0.75rem 2rem;
}

/* Rounded alerts */
.alert {
    border-radius: 1rem !important;
    border: none;
}

/* Rounded dropdowns */
.dropdown-menu {
    border-radius: 1rem !important;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.15));
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .dropdown-menu {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    border-radius: 0.5rem !important;
    margin: 0.25rem 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

/* Rounded modals */
.modal-content {
    border-radius: 1.5rem !important;
    border: none;
}

.modal-header {
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.125));
    border-radius: 1.5rem 1.5rem 0 0 !important;
}

.modal-footer {
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.125));
    border-radius: 0 0 1.5rem 1.5rem !important;
}

/* Feature icons for cards */
.feature-icon {
    width: 60px;
    height: 60px;
    background: rgba(29, 124, 186, 0.1);
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.feature-icon i {
    width: 28px;
    height: 28px;
}

/* Brand styling */
.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color, #1d7cba);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon i {
    color: white !important;
    width: 20px;
    height: 20px;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color, #1d7cba), #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Theme toggle button */
#theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 0.75rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
}

#theme-toggle:hover {
    background-color: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.1) !important;
}

/* Navigation improvements */
.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.1);
}

/* Table improvements */
.table {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.table th {
    background-color: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.1);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color, #1d7cba);
}

/* Badge improvements */
.badge {
    border-radius: 0.5rem !important;
    font-weight: 500;
}

/* Progress bars */
.progress {
    border-radius: 1rem !important;
    height: 0.75rem;
}

.progress-bar {
    border-radius: 1rem !important;
}

/* Input groups */
.input-group .form-control:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group .form-control:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.input-group .btn {
    border-radius: 0 !important;
}

.input-group .btn:last-child {
    border-top-right-radius: 1rem !important;
    border-bottom-right-radius: 1rem !important;
}

.input-group .btn:first-child {
    border-top-left-radius: 1rem !important;
    border-bottom-left-radius: 1rem !important;
}

/* List groups */
.list-group {
    border-radius: 1rem !important;
}

.list-group-item:first-child {
    border-top-left-radius: 1rem !important;
    border-top-right-radius: 1rem !important;
}

.list-group-item:last-child {
    border-bottom-left-radius: 1rem !important;
    border-bottom-right-radius: 1rem !important;
}

/* Pagination */
.page-link {
    border-radius: 0.5rem !important;
    margin: 0 0.125rem;
    border: 1px solid var(--border-color, #dee2e6);
}

.page-item:first-child .page-link,
.page-item:last-child .page-link {
    border-radius: 0.5rem !important;
}

/* Tooltips and popovers */
.tooltip .tooltip-inner {
    border-radius: 0.5rem !important;
}

.popover {
    border-radius: 1rem !important;
}

/* Dashboard specific styles */
.dashboard-card {
    border-radius: 1.5rem !important;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .dashboard-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color, #1d7cba) 0%, #764ba2 100%);
    border-radius: 1.5rem !important;
    color: white !important;
    border: none;
}

.stat-card * {
    color: white !important;
}

.stat-card .stat-number {
    color: white !important;
}

.stat-card .stat-label {
    color: white !important;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Call logs table */
.call-logs-table {
    border-radius: 1rem !important;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.call-logs-table th {
    background: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.1);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color, #1d7cba);
}

.call-logs-table tr:hover {
    background-color: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.05);
}

/* Login/Register forms */
.auth-card {
    border-radius: 2rem !important;
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] .auth-card {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.auth-card .card-header {
    border-radius: 2rem 2rem 0 0 !important;
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.125));
    background: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.05);
}

/* Top-up form */
.topup-form .card {
    border-radius: 1.5rem !important;
    border: 2px solid rgba(var(--bs-primary-rgb, 29, 124, 186), 0.2);
}

.payment-method-card {
    border-radius: 1rem !important;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.payment-method-card:hover {
    border-color: var(--primary-color, #1d7cba);
    transform: translateY(-2px);
}

.payment-method-card.active {
    border-color: var(--primary-color, #1d7cba);
    background: rgba(var(--bs-primary-rgb, 29, 124, 186), 0.05);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card {
        border-radius: 1rem !important;
    }
    
    .auth-card {
        border-radius: 1.5rem !important;
    }
    
    .dashboard-card {
        border-radius: 1rem !important;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
    }
    
    .feature-icon i {
        width: 24px;
        height: 24px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border-width: 2px;
    }
    
    .form-control,
    .form-select {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    #theme-toggle {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    main {
        padding-top: 0 !important;
    }
}

/* Subtle placeholder styling for phone input */
input[type="tel"]::placeholder {
    color: #9ca3af !important;
    opacity: 0.6 !important;
    font-weight: 300 !important;
    font-style: italic;
}

input[type="tel"]:focus::placeholder {
    opacity: 0.4 !important;
}

[data-bs-theme="dark"] input[type="tel"]::placeholder {
    color: #6b7280 !important;
    opacity: 0.7 !important;
}

/* Playful emoji animations for PDF export */
.pdf-loading-emoji {
    display: inline-block;
    animation: bounce 0.6s ease-in-out infinite alternate;
    margin-right: 0.5rem;
    font-size: 1.2em;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
    text-shadow: 0 0 8px rgba(255,255,255,0.3);
}

.pdf-success-emoji {
    display: inline-block;
    animation: celebration 1s ease-in-out;
    margin-right: 0.5rem;
    font-size: 1.2em;
}

@keyframes bounce {
    0% {
        transform: translateY(0px) scale(1);
    }
    100% {
        transform: translateY(-5px) scale(1.1);
    }
}

@keyframes celebration {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.3) rotate(-5deg);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.5) rotate(5deg);
        opacity: 0.8;
    }
    75% {
        transform: scale(1.2) rotate(-3deg);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* PDF loading button special styling */
button:has(.pdf-loading-emoji) {
    background: linear-gradient(45deg, var(--primary-color, #1d7cba), #764ba2) !important;
    border: none !important;
    color: white !important;
    position: relative;
    overflow: hidden;
}

button:has(.pdf-loading-emoji)::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(30deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(30deg);
    }
}