:root {
    --bs-primary: #1a6fd4;
    --bs-secondary: #64748b;
    --bs-success: #10b981;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-info: #3b82f6;
    --bs-light: #f8fafc;
    --bs-dark: #0f172a;
    --bs-border-color: #e2e8f0;
}

/* Base body background with gradient */
body {
    background: linear-gradient(135deg, #e8f0fb 0%, #f4f6fa 50%, #fff5eb 100%);
    min-height: 100vh;
    margin: 0;
    font-family: var(--bs-font-sans-serif);
}

/* Utility Classes */
.hover-bg-light:hover {
    background-color: var(--bs-light) !important;
}

.file-upload {
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload:hover {
    border-color: var(--bs-primary) !important;
    background-color: rgba(26, 111, 212, 0.05);
}

.border-dashed {
    border-style: dashed !important;
}

.font-monospace {
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* Phone Preview - Modern Realistic Design */
.phone-preview {
    max-width: 100%;
    margin: 0 auto;
    perspective: 1000px;
}

.phone-frame {
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: 2.8rem;
    padding: 0.55rem;
    position: relative;
    max-width: 300px;
    margin: 0 auto;
    box-shadow: 
        /* Outer shadow */
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 10px 20px rgba(0, 0, 0, 0.3),
        /* Frame shine effect */
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        /* Metallic border effect */
        0 0 0 4px rgba(30, 30, 30, 0.8),
        0 0 0 5px rgba(60, 60, 60, 0.3),
        0 0 0 6px rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transform: translateZ(0);
    transition: all 0.3s ease;
}

.phone-frame:hover {
    transform: translateY(-2px) translateZ(10px);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 15px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.6),
        0 0 0 4px rgba(30, 30, 30, 0.9),
        0 0 0 5px rgba(70, 70, 70, 0.4),
        0 0 0 6px rgba(30, 30, 30, 0.9);
}

.phone-frame-shadow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    background: radial-gradient(ellipse at center, 
        rgba(0, 0, 0, 0.3) 0%, 
        rgba(0, 0, 0, 0) 70%);
    border-radius: 3.2rem;
    z-index: -1;
    pointer-events: none;
}

.phone-notch {
    width: 140px;
    height: 28px;
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: 0 0 1.2rem 1.2rem;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-top: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
}

.notch-camera {
    width: 10px;
    height: 10px;
    background: linear-gradient(145deg, #333 0%, #111 100%);
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.5);
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 0 2px rgba(0, 0, 0, 0.3);
}

.notch-speaker {
    width: 50px;
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.5) 2px,
        rgba(0, 0, 0, 0.5) 4px
    );
}

.phone-screen {
    background: white;
    border-radius: 2.1rem;
    overflow: hidden;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    box-shadow: 
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.phone-status-bar {
    background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    height: 52px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.phone-status-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-status-icons i {
    font-size: 0.8rem;
    opacity: 0.9;
}

.phone-header {
    background: linear-gradient(145deg, #374151 0%, #283140 100%);
    color: white;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 70px;
}

.phone-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1a6fd4 0%, #2d88f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(26, 111, 212, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.phone-contact-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.phone-brand {
    font-size: 1.05rem;
    font-weight: 600;
}

.phone-contact-status {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 400;
}

.phone-content {
    flex: 1;
    padding: 1.75rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    position: relative;
}

.phone-home-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: #1f2937;
    border-radius: 2px;
    z-index: 20;
    opacity: 0.9;
}

/* Message Card */
.message-card {
    background: white;
    border-radius: 0.85rem;
    overflow: hidden;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 260px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transform: translateZ(0);
    transition: all 0.3s ease;
}

.message-card:hover {
    transform: translateY(-2px) translateZ(5px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card-image {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.8) 50%, 
        transparent 100%);
}

.message-card .card-body {
    max-height: 110px;
    overflow-y: auto;
    padding: 1.2rem;
    background: white;
}

.message-card .card-title {
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.message-card .card-text {
    color: #475569;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.message-time {
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.gift-boxes {
    display: flex;
    gap: 1.2rem;
    align-items: flex-end;
    position: relative;
    z-index: 2;
}

.gift-box {
    position: relative;
    border-radius: 0.6rem;
    transform-style: preserve-3d;
    animation: float 3s ease-in-out infinite;
}

.gift-box.red {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 
        0 6px 12px rgba(239, 68, 68, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    animation-delay: 0s;
}

.gift-box.green {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 
        0 6px 12px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    animation-delay: 0.5s;
}

.gift-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.6rem 0.6rem 0 0;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotateX(0deg); }
    50% { transform: translateY(-8px) rotateX(5deg); }
}

.sparkle {
    position: absolute;
    color: #facc15;
    font-size: 1.3rem;
    animation: sparkle 2s infinite;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
    z-index: 1;
}

.sparkle-2 {
    top: 1rem;
    left: 1rem;
    animation-delay: 0.3s;
}

.sparkle-3 {
    bottom: 1rem;
    right: 1rem;
    animation-delay: 0.6s;
}

@keyframes sparkle {
    0%, 100% { 
        opacity: 0.3; 
        transform: scale(0.8) rotate(0deg); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.3) rotate(180deg); 
    }
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Layout */
.main-content {
    margin-left: 220px;
    margin-top: 64px;
    transition: all 0.3s ease;
    min-height: calc(100vh - 64px);
    background: transparent; /* Let body gradient show through */
}

.welcome-section {
    padding: 1.5rem 0 0;
}

/* Cards */
.card {
    border-radius: 0.75rem;
    border: 1px solid var(--bs-border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: rgba(255, 255, 255, 0.9); /* Slightly transparent to show gradient */
    backdrop-filter: blur(4px);
}

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

.stats-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--bs-border-color);
    backdrop-filter: blur(4px);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-header a :hover {
    cursor: pointer;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #1158b0;
    border-color: #1158b0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 111, 212, 0.25);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(26, 111, 212, 0.25);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.char-counter {
    font-size: 0.875rem;
}

/* Tabs */
.nav-tabs .nav-link {
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    background-color: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Table Base Styles */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

#contactsTable {
    width: 100%;
    font-size: 0.875rem;
}

#contactsTable th:first-child,
#contactsTable td:first-child {
    padding-left: 1rem;
}

#contactsTable th:last-child,
#contactsTable td:last-child {
    padding-right: 1rem;
}

.table .form-check-input {
    cursor: pointer;
    transition: all 0.2s ease;
}

.table .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(26, 111, 212, 0.25);
}

#contactsTable tbody tr {
    transition: all 0.2s ease;
}

#contactsTable tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-selected {
    animation: highlightRow 0.3s ease;
}

@keyframes highlightRow {
    from { background-color: rgba(26, 111, 212, 0.05); }
    to { background-color: rgba(26, 111, 212, 0.1); }
}

/* Responsive adjustments for phone preview */
@media (max-width: 1200px) {
    .phone-frame {
        max-width: 280px;
    }
    
    .phone-screen {
        min-height: 480px;
    }
}

@media (max-width: 992px) {
    .phone-preview {
        max-width: 260px;
        margin: 0 auto;
    }
    
    .phone-frame {
        max-width: 260px;
        border-radius: 2.4rem;
        padding: 0.7rem;
    }
    
    .phone-screen {
        min-height: 450px;
        border-radius: 1.8rem;
    }
    
    .phone-notch {
        width: 120px;
        height: 24px;
    }
}

@media (max-width: 768px) {
    .phone-preview {
        max-width: 240px;
    }
    
    .phone-frame {
        max-width: 240px;
        border-radius: 2.2rem;
        padding: 0.6rem;
    }
    
    .phone-screen {
        min-height: 420px;
        border-radius: 1.6rem;
    }
    
    .message-card {
        max-width: 220px;
    }
}

@media (max-width: 576px) {
    .phone-preview {
        max-width: 220px;
    }
    
    .phone-frame {
        max-width: 220px;
        border-radius: 2rem;
        padding: 0.5rem;
    }
    
    .phone-screen {
        min-height: 400px;
        border-radius: 1.5rem;
    }
    
    .phone-content {
        padding: 1.25rem;
    }
    
    .message-card {
        max-width: 200px;
    }
    
    .gift-box.red {
        width: 45px;
        height: 45px;
    }
    
    .gift-box.green {
        width: 55px;
        height: 55px;
    }
}

/* Desktop - Large (≥1200px) */
@media (min-width: 1200px) {
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 1.25rem;
    }
}

/* Desktop - Medium (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .table {
        font-size: 0.9375rem;
    }
    
    .table th,
    .table td {
        padding: 1rem;
    }
}

/* Tablet - Large (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .sidebar-close{
        display: flex;
    }
    .main-content {
        margin-left: 0;
    }
    
    .table-responsive {
        border: 1px solid var(--bs-border-color);
        border-radius: 0.75rem;
    }
    
    .table {
        font-size: 0.875rem;
        min-width: 100%;
    }
    
    .table th,
    .table td {
        padding: 0.875rem 0.75rem;
    }
    
    .table td:nth-child(2) {
        font-family: 'SFMono-Regular', monospace;
        font-size: 0.8125rem;
    }
    
    .badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Tablet - Medium (711px - 767px) */
@media (min-width: 711px) and (max-width: 767px) {
    .sidebar-close{
        display: flex !important;
    }
    .main-content {
        margin-left: 0;
    }
    
    .table-responsive {
        border: 1px solid var(--bs-border-color);
        border-radius: 0.75rem;
    }
    
    .table {
        font-size: 0.8125rem;
        min-width: 100%;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .table th {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .table td:nth-child(2) {
        font-size: 0.75rem;
        font-family: 'SFMono-Regular', monospace;
    }
    
    .badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.6875rem;
    }
    
    .table-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Tablet - Small (576px - 710px) */
@media (min-width: 576px) and (max-width: 710px) {
    .sidebar-close{
        display: flex !important;
    }
    .main-content {
        margin-left: 0;
    }
    
    .table-responsive {
        border: 1px solid var(--bs-border-color);
        border-radius: 0.75rem;
    }
    
    .table {
        min-width: 650px;
        font-size: 0.8125rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .table th {
        font-size: 0.75rem;
    }
    
    .table td:nth-child(2) {
        font-size: 0.75rem;
        font-family: 'SFMono-Regular', monospace;
    }
    
    .badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.6875rem;
    }
    
    .table-actions .btn span {
        display: none;
    }
    
    .table-actions .btn i {
        margin: 0;
    }
    
    .table-actions .btn {
        padding: 0.25rem;
        min-width: 32px;
    }
}

/* Mobile - Large (481px - 575px) */
@media (max-width: 575px) {
    .main-content {
        margin-left: 0;
    }
    
    .table-responsive {
        border: none;
        border-radius: 0;
        overflow: visible;
    }

    .sidebar-close{
        display: flex !important;
    }
    
    .table {
        display: block;
        min-width: 100%;
        background: transparent;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody {
        display: block;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(4px);
        border-radius: 0.75rem;
        border: 1px solid var(--bs-border-color);
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .table tbody td {
        display: block;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.8125rem;
    }
    
    .table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .table tbody td:first-child {
        padding-top: 0;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 0.75rem;
    }
    
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    .table tbody td:first-child::before {
        display: none;
    }
    
    .table tbody td:first-child .form-check {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }
    
    .table tbody td:first-child .form-check-label {
        font-weight: 600;
        color: #1e293b;
    }
    
    .table tbody td:nth-child(2) {
        font-family: 'SFMono-Regular', monospace;
        font-size: 0.75rem;
    }
    
    .badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table-actions {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #f1f5f9;
    }
}

/* Mobile - Small (≤480px) */
@media (max-width: 480px) {
    .table tbody tr {
        padding: 0.875rem;
        margin-bottom: 0.75rem;
        overflow: auto;
    }
    
    .table tbody td {
        padding: 0.375rem 0;
        font-size: 0.8125rem;
    }
    
    .table tbody td::before {
        font-size: 0.6875rem;
    }
    
    .badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.6875rem;
    }
    
    .table-actions .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Mobile - Extra Small (≤375px) */
@media (max-width: 375px) {
    .table tbody tr {
        padding: 0.75rem;
    }
    
    .table tbody td {
        padding: 0.25rem 0;
        font-size: 0.75rem;
    }
    
    .table tbody td::before {
        font-size: 0.625rem;
    }
    
    .badge {
        padding: 0.125rem 0.375rem;
        font-size: 0.625rem;
    }
    
    .table-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .table-actions .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.6875rem;
    }
}

/* Print Styles */
@media print {
    .table-responsive {
        overflow: visible !important;
    }
    
    .table {
        border: 1px solid #000;
    }
    
    .table th,
    .table td {
        border: 1px solid #000;
    }
}

label.form-label{
    font-size: 0.9rem;
}

textarea {
    font-size: 0.9rem !important;
}

input {
    font-size: 0.9rem !important;
}

select {
    font-size: 0.9rem !important;
}

ul#recipientTabs {
    font-size: 1rem;
}