/* Dashboard Widget Styles */

.dashboard-widget {
    transition: all 0.3s ease;
}

/* Widget card wrapper - position relative for resize handle */
.widget-card-wrapper {
    position: relative;
}

/* Widget Resize Handle */
.widget-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(to right, transparent, rgba(13, 110, 253, 0.1));
}

.widget-card-wrapper:hover .widget-resize-handle {
    opacity: 1;
}

.widget-resize-handle i {
    color: #0d6efd;
    font-size: 12px;
    pointer-events: none;
}

.widget-resize-handle:hover {
    background: linear-gradient(to right, transparent, rgba(13, 110, 253, 0.2));
}

.widget-resize-handle:active {
    background: linear-gradient(to right, transparent, rgba(13, 110, 253, 0.3));
}

/* Show resize handle when resizing */
.dashboard-widget.is-resizing .widget-resize-handle {
    opacity: 1;
    background: linear-gradient(to right, transparent, rgba(13, 110, 253, 0.3));
}

/* Disable pointer events on cards during resize */
.dashboard-widget.is-resizing .card {
    pointer-events: none;
    user-select: none;
}

.dashboard-widget .card-head {
    cursor: default;
}

/* Make all stat blocks same height (exclude bank accounts widget) */
.dashboard-widget:not([data-widget-type="bank_accounts"]) .card-innr > .row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.dashboard-widget:not([data-widget-type="bank_accounts"]) .card-innr > .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.dashboard-widget:not([data-widget-type="bank_accounts"]) .card-innr > .row > [class*="col-"] > .d-flex {
    flex: 1;
    min-height: 80px;
}

/* Make all widgets in the same row match heights */
.dashboard-widget {
    display: flex;
    flex-direction: column;
}

/* Support for turbo-frame wrapper */
.dashboard-widget > turbo-frame {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.dashboard-widget > .card,
.dashboard-widget > turbo-frame > .card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dashboard-widget > .card > .card-innr,
.dashboard-widget > turbo-frame > .card > .card-innr {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Drag handle icon */
.widget-drag-handle {
    cursor: grab;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.widget-drag-handle:hover {
    opacity: 1;
    transform: scale(1.1);
}

.widget-drag-handle:active {
    cursor: grabbing;
}

/* Drag states */
.widget-ghost {
    opacity: 0.4;
    background: #f8f9fa;
}

.widget-chosen {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.widget-drag {
    opacity: 0.8;
}

/* Widget customization button */
.widget-customize-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.widget-customize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Widget settings modal */
.widget-settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-settings-item {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.widget-settings-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.widget-settings-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.2rem;
}

.widget-settings-text h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.widget-settings-text p {
    margin: 0;
    font-size: 0.75rem;
    color: #6c757d;
}

/* Toggle switch */
.widget-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.widget-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.widget-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.widget-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.widget-toggle input:checked + .widget-toggle-slider {
    background-color: #0d6efd;
}

.widget-toggle input:checked + .widget-toggle-slider:before {
    transform: translateX(24px);
}

/* Notifications Dropdown Styles */

/* Notification bell icon with circular background */
.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0087F7 0%, #0d6efd 100%);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 135, 247, 0.3);
}

.notification-bell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 135, 247, 0.4);
    background: linear-gradient(135deg, #0d6efd 0%, #0087F7 100%);
}

.notification-bell .fa-bell {
    color: white;
    font-size: 18px;
}

/* User profile icon with matching circular background */
.user-thumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0087F7 0%, #0d6efd 100%);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 135, 247, 0.3);
}

.user-thumb:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 135, 247, 0.4);
    background: linear-gradient(135deg, #0d6efd 0%, #0087F7 100%);
}

.user-thumb .fa-user {
    color: white;
    font-size: 18px;
}

.notification-bell .notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.notifications-dropdown {
    padding: 0;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notifications-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
}

.notifications-header h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.notifications-header .btn-link {
    font-size: 0.85rem;
    text-decoration: none;
    color: #0d6efd;
    transition: color 0.2s ease;
}

.notifications-header .btn-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.notifications-list {
    overflow-y: auto;
    max-height: 400px;
    flex: 1;
}

.notification-item {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    transition: background-color 0.2s ease;
    position: relative;
}

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

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

.notification-item.unread {
    background-color: #e7f3ff;
}

.notification-item.unread:hover {
    background-color: #d4e9ff;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon i {
    font-size: 1rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.notification-link:hover {
    color: inherit;
}

.notification-message {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #212529;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.notification-time {
    font-size: 0.75rem;
    color: #6c757d;
}

.notification-actions {
    flex-shrink: 0;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-actions .badge-sm {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    background: #0d6efd;
}

.btn-notification-delete {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-notification-delete:hover {
    color: #dc3545;
}

.btn-notification-delete:focus {
    outline: none;
}

/* Legacy support for old badge class */
.notification-item .notification-badge {
    flex-shrink: 0;
    align-self: flex-start;
}

.notification-item .notification-badge .badge-sm {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    background: #0d6efd;
}

.notification-empty {
    padding: 3rem 1.25rem;
    text-align: center;
    color: #6c757d;
}

.notification-empty i {
    margin-bottom: 0.75rem;
    display: block;
}

.notification-empty p {
    font-size: 0.875rem;
    margin: 0;
}

.notifications-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    background: #f8f9fa;
}

.notifications-footer .btn-link {
    font-size: 0.875rem;
    text-decoration: none;
    color: #0d6efd;
    font-weight: 500;
    transition: color 0.2s ease;
}

.notifications-footer .btn-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* Scrollbar styling for notifications list */
.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.notifications-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.notifications-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
