/* Custom CSS for Reminder Web */

/* Background gradient */
.bg-gradient-primary {
    background: linear-gradient(90deg, #4e73df 0%, #224abe 100%);
    background-size: cover;
}

/* Card styling */
.card {
    border-radius: 1rem;
    overflow: hidden; /* Ensure child elements don't overflow the border-radius */
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    border-radius: 1rem 1rem 0 0; /* Top corners rounded to match card */
    margin: 0; /* Remove any margin that might cause overlap */
}

.card-footer {
    border-radius: 0 0 1rem 1rem; /* Bottom corners rounded to match card */
    margin: 0; /* Remove any margin that might cause overlap */
}

.card-body {
    border-radius: 0; /* Body should not have rounded corners when there's header/footer */
}

/* Form styling */
.form-control-user {
    font-size: 0.8rem;
    border-radius: 10rem;
    padding: 1.5rem 1rem;
}

.btn-user {
    font-size: 0.8rem;
    border-radius: 10rem;
    padding: 0.75rem 1rem;
}

/* Background images for login/register */
.bg-login-image {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100%;
}

.bg-login-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" opacity="0.1"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>') center center/60px no-repeat;
    pointer-events: none;
}

/* Logo container in login image */
.bg-login-image .logo-container {
    text-align: center;
    color: white;
    z-index: 1;
    position: relative;
    padding: 2rem;
}

.bg-login-image .logo-container i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.95;
    display: block;
}

.bg-login-image .logo-container h3 {
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    opacity: 0.95;
    letter-spacing: 0.5px;
}

.bg-login-image .logo-container p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

.bg-register-image {
    background: linear-gradient(135deg, #224abe 0%, #4e73df 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100%;
}

.bg-register-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" opacity="0.1"><path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>') center center/60px no-repeat;
    pointer-events: none;
}

.bg-register-image .logo-container {
    text-align: center;
    color: white;
    z-index: 1;
    position: relative;
    padding: 2rem;
}

.bg-register-image .logo-container i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.95;
    display: block;
}

.bg-register-image .logo-container h3 {
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    opacity: 0.95;
    letter-spacing: 0.5px;
}

.bg-register-image .logo-container p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

.bg-password-image {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100%;
}

.bg-password-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" opacity="0.1"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"/></svg>') center center/60px no-repeat;
    pointer-events: none;
}

.bg-password-image .logo-container {
    text-align: center;
    color: white;
    z-index: 1;
    position: relative;
    padding: 2rem;
}

.bg-password-image .logo-container i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.95;
    display: block;
}

.bg-password-image .logo-container h3 {
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    opacity: 0.95;
    letter-spacing: 0.5px;
}

.bg-password-image .logo-container p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Text colors */
.text-gray-900 {
    color: #5a5c69 !important;
}

.text-white-75 {
    color: rgba(255, 255, 255, 0.75) !important;
}

.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Custom checkbox */
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: #4e73df;
    border-color: #4e73df;
}

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

/* Alert animations */
.alert {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form validation */
.is-invalid {
    border-color: #dc3545;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Add Task page styling */
.border-left-success {
    border-left: 4px solid #1cc88a !important;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

.form-label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

.form-label i {
    color: #4e73df;
}

.form-control:focus,
.form-select:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 0.5rem;
}

/* Character counter styling */
.text-warning {
    color: #f6c23e !important;
}

.text-danger {
    color: #e74a3b !important;
}

/* Validation styling */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #1cc88a;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%231cc88a' d='m2.3 6.73.94-.94 2.94 2.94L8.5 6.4 7.06 5l-2.94 2.94z'/%3e%3c/svg%3e");
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #e74a3b;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23e74a3b'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.5 5.5 1 1m0-1-1 1'/%3e%3c/svg%3e");
}

/* Loading button animation */
.btn .fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive adjustments for add task form */
@media (max-width: 768px) {
    .btn-lg {
        font-size: 0.9rem;
        padding: 0.6rem 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .h3 {
        font-size: 1.5rem;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .card {
        margin: 1rem;
    }
    
    .p-5 {
        padding: 2rem !important;
    }
    
    .bg-login-image,
    .bg-register-image {
        display: none !important;
    }
}

/* Dashboard specific styles */
.navbar-brand {
    font-weight: bold;
}

.text-lg {
    font-size: 1.25rem;
}

/* Hover effects */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.15s ease-in-out;
}

/* Task cards styling */
.task-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid #e3e6f0;
    border-radius: 1rem;
    overflow: hidden; /* Ensure child elements don't overflow */
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.task-card .card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.75rem 1rem;
    border-radius: 1rem 1rem 0 0; /* Top corners rounded to match card */
    margin: 0;
    position: relative;
}

.task-card .card-header h6 {
    margin-right: 2rem; /* Give space for checkbox */
    line-height: 1.4;
}

.task-card .card-header .form-check {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    margin: 0;
}

.task-card .card-header .form-check-input {
    margin-top: 0;
}

.task-card .card-header .form-check-label {
    padding-left: 0.25rem;
    margin-bottom: 0;
    cursor: pointer;
}

.task-card .card-header .form-check-label i {
    font-size: 1.1rem;
}

.task-card .card-body {
    padding: 1rem;
    border-radius: 0; /* No border radius for middle section */
}

.task-card .card-footer {
    background-color: #f8f9fc;
    border-top: 1px solid #e3e6f0;
    padding: 0.5rem 1rem;
    border-radius: 0 0 1rem 1rem; /* Perfect rounded bottom corners */
    margin: 0;
}

.task-details {
    background-color: #f8f9fc;
    border-radius: 0.375rem;
    padding: 0.75rem;
    border-left: 4px solid #4e73df;
}

.task-checkbox {
    cursor: pointer;
    transform: scale(1.2);
}

.task-checkbox:hover {
    transform: scale(1.3);
}

/* Navigation active state */
.navbar-nav .nav-link.active {
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* Empty and error states */
.text-center i.fa-3x {
    opacity: 0.3;
}

/* Pagination styling */
.pagination .page-link {
    border-color: #4e73df;
    color: #4e73df;
}

.pagination .page-item.active .page-link {
    background-color: #4e73df;
    border-color: #4e73df;
}

.pagination .page-link:hover {
    background-color: #e3f2fd;
    border-color: #4e73df;
    color: #4e73df;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #4e73df;
}

/* Clickable dashboard cards */
.clickable-card {
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.clickable-card:hover {
    transform: translateY(-2px);
}

.clickable-card .card-footer {
    font-size: 0.875rem;
}

/* User display in navbar */
#userDisplay {
    display: flex;
    align-items: center;
    margin-left: 1rem;
    margin-right: 0.5rem;
}

#userDisplay .navbar-text {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    margin: 0;
    white-space: nowrap;
}

#userDisplay .navbar-text:hover {
    color: rgba(255, 255, 255, 1) !important;
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#userDisplay .navbar-text .fw-medium {
    font-weight: 600;
}

#userDisplay .navbar-text i {
    opacity: 0.8;
}

/* Separator before user display */
#userDisplay::before {
    content: "";
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    margin-right: 1rem;
    display: block;
}

/* Responsive navbar user display */
@media (max-width: 768px) {
    #userDisplay {
        margin-left: 0.5rem;
        margin-right: 0.25rem;
    }
    
    #userDisplay::before {
        margin-right: 0.5rem;
        height: 16px;
    }
    
    #userDisplay .navbar-text {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .navbar-nav .nav-link {
        margin-right: 0.25rem;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .navbar-nav.d-flex.align-items-center {
        gap: 0.25rem;
    }
}

/* Navbar spacing improvements */
.navbar-nav .nav-link {
    margin-right: 0.5rem;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

.navbar-nav .nav-link:last-child {
    margin-right: 0;
}

/* Better navbar layout */
.navbar-nav.d-flex.align-items-center {
    gap: 0.5rem;
}

/* Task Card Visual Differentiation */

/* Recurring tasks styling */
.task-card.recurring {
    border-left: 4px solid #28a745 !important;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.03) 0%, rgba(40, 167, 69, 0.01) 100%);
    position: relative;
}

.task-card.recurring::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #28a745 0%, rgba(40, 167, 69, 0.1) 100%);
}

/* One-time tasks styling */
.task-card.one-time {
    border-left: 2px solid #dee2e6 !important;
    background: #ffffff;
}

/* Frequency text styling */
.frequency-recurring {
    color: #28a745 !important;
    font-weight: 600;
}

.frequency-recurring i {
    color: #28a745;
    animation: spin-slow 8s linear infinite;
}

/* Pause animation on card hover for better readability */
.task-card:hover .frequency-recurring i {
    animation-play-state: paused;
}

.frequency-one-time {
    color: #6c757d !important;
    font-weight: 500;
}

.frequency-one-time i {
    color: #6c757d;
}

/* Subtle animation for recurring task icon */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Task card hover effects */
.task-card.recurring:hover {
    border-left-color: #1e7e34 !important;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.06) 0%, rgba(40, 167, 69, 0.02) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.task-card.one-time:hover {
    border-left-color: #adb5bd !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Task header styling for recurring tasks */
.task-card.recurring .card-header {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0%, rgba(40, 167, 69, 0.02) 100%);
    border-bottom: 1px solid rgba(40, 167, 69, 0.1);
}

.task-card.recurring .card-header h6 {
    color: #1e7e34;
}

.task-card.recurring .card-header .fas.fa-tasks {
    color: #28a745;
}

/* Frequency badge styling - REMOVED to avoid overlap with checkbox */
/* 
.frequency-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.frequency-badge.recurring {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.frequency-badge.one-time {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}
*/

/* Improved checkbox positioning */
.task-card .card-header .form-check {
    margin-left: auto;
    margin-right: 0;
}

/* Improved task card header layout */
.task-card .card-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem; /* Add gap between title and checkbox */
}

.task-card .card-header h6 {
    margin: 0;
    line-height: 1.4;
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 50px); /* Reserve space for checkbox */
}

.task-card .card-header .form-check {
    margin: 0;
    flex-shrink: 0;
    width: 40px; /* Fixed width for checkbox area */
    display: flex;
    justify-content: center;
    align-items: center;
}

.task-card .card-header .form-check-input {
    margin-top: 0;
    margin-bottom: 0;
}

.task-card .card-header .form-check-label {
    padding-left: 0.25rem;
    margin-bottom: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.task-card .card-header .form-check-label i {
    font-size: 1.1rem;
}

/* Ensure proper spacing on mobile */
@media (max-width: 576px) {
    .task-card .card-header {
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
    }
    
    .task-card .card-header h6 {
        font-size: 0.95rem;
        max-width: calc(100% - 45px);
    }
    
    .task-card .card-header .form-check {
        width: 35px;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .task-card.recurring,
    .task-card.one-time {
        border-left-width: 3px !important;
    }
}

/* Weekend icon styling */
.task-details .text-info {
    color: #17a2b8 !important;
    font-weight: 500;
}

.task-details .text-info i {
    color: #17a2b8;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* Weekend icon hover effect */
.task-card:hover .task-details .text-info i {
    animation-play-state: paused;
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Weekday checkboxes styling */
.weekday-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.weekday-checkboxes .form-check-inline {
    margin-right: 0;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.weekday-checkboxes .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0;
    margin-bottom: 0;
}

.weekday-checkboxes .form-check-label {
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.weekday-checkboxes .form-check-input:checked + .form-check-label {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.weekday-checkboxes .form-check-input:checked + .form-check-label:hover {
    background-color: #bbdefb;
    border-color: #90caf9;
}

.weekday-checkboxes .form-check-label:hover {
    background-color: #f5f5f5;
}

/* Responsive weekday checkboxes */
@media (max-width: 768px) {
    .weekday-checkboxes {
        gap: 0.5rem;
    }
    
    .weekday-checkboxes .form-check-label {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Month day checkboxes styling */
.monthday-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.monthday-group {
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 1rem;
    background-color: #f8f9fc;
}

.monthday-group h6 {
    margin-bottom: 0.75rem;
    color: #5a5c69;
    font-weight: 600;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.monthday-checkboxes .form-check-inline {
    margin-right: 0;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.monthday-checkboxes .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0;
    margin-bottom: 0;
}

.monthday-checkboxes .form-check-label {
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e3e6f0;
    min-width: 2.5rem;
    justify-content: center;
}

.monthday-checkboxes .form-check-input:checked + .form-check-label {
    background-color: #4e73df;
    color: #ffffff;
    border-color: #4e73df;
    box-shadow: 0 2px 4px rgba(78, 115, 223, 0.2);
}

.monthday-checkboxes .form-check-input:checked + .form-check-label:hover {
    background-color: #2e59d9;
    border-color: #2e59d9;
}

.monthday-checkboxes .form-check-label:hover {
    background-color: #f8f9fc;
    border-color: #4e73df;
}

@media (max-width: 768px) {
    .monthday-checkboxes {
        gap: 0.75rem;
    }
    
    .monthday-group {
        padding: 0.75rem;
    }
    
    .checkbox-row {
        gap: 0.25rem;
    }
    
    .monthday-checkboxes .form-check-label {
        padding: 0.375rem 0.5rem;
        min-width: 2rem;
        font-size: 0.875rem;
    }
}
