/* Base & Reset */
body {
    background-color: #e5e7eb; /* bg-gray-200 fallback */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

/* Phone Frame */
@media (min-width: 640px) {
    #phone-frame {
        border: 8px solid #1f2937; /* sm:border-gray-800 */
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        border-radius: 3rem;
    }
}

/* Boot Screen */
#boot-screen {
    position: absolute; /* Fixed to phone frame */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 9999;
}

.fade-out {
    animation: fadeOut 0.8s ease forwards;
}

#boot-screen .animate-spin {
    animation: spin 1s linear infinite;
}

#boot-screen .rounded-2xl {
    animation: scaleIn 0.5s ease-out forwards;
}

/* Lock Screen */
#lock-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#lock-screen .animate-bounce {
    animation: bounceUp 2s ease-in-out infinite;
}

#lock-clock {
    font-weight: 100;
    font-size: 4.5rem;
    color: white;
}

.unlocking {
    animation: unlockScreen 0.5s ease forwards;
}

/* Home Screen */
#home-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* App Icons Grid */
#home-screen .grid button, #dock button {
    outline: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

#home-screen .grid button:active, #dock button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Icon Box sizing (some already in Tailwind, but strictly matching spec here) */
.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.icon-label {
    font-size: 0.75rem; /* text-xs */
    color: white;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.6);
}

/* Status Bar */
#status-bar {
    height: 44px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.1); /* Semi-transparent */
}

/* Dynamic Island/Notch */
#status-bar .bg-black {
    width: 120px;
    height: 28px;
    border-radius: 9999px;
    margin: 0 auto;
}

#status-bar svg {
    width: 16px;
    height: 16px;
    /* dark color for light theme usually, but currently white in HTML */
}

/* Dock */
#dock {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
}

/* Control Center */
#control-center {
    position: absolute;
    width: 100%;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

#control-center.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto;
}

/* Custom Sliders for Control Center */
#control-center input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    height: 8px;
    border-radius: 4px;
    outline: none;
}

#control-center input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

/* Toggle Buttons Active State */
#control-center button.active {
    background-color: #3b82f6; /* blue-500 */
}

#control-center button:active {
    transform: scale(0.95);
}

/* App Screen */
#app-screen {
    background-color: white;
}

.slide-in {
    animation: slideInRight 0.3s ease forwards;
}

.slide-out {
    animation: slideOutRight 0.3s ease forwards;
}

#app-header {
    height: 56px;
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    z-index: 10;
}

#app-body {
    overflow-y: auto;
    width: 100%;
    height: 100%;
}

/* Call Screen */
#call-screen {
    background: linear-gradient(to bottom, #111827, #000000);
}

/* For active call pulsing indicator */
#call-screen .active-indicator {
    animation: pulse 2s infinite;
}

/* End call button pulsing */
#call-screen button.bg-red-500 {
    animation: pulseRed 2s infinite;
}

#call-screen button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Notifications */
.notification-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease forwards;
}

.notification-card.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* Lightbox Overlay */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

/* Scrollbar Hiding */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Interactive elements general active states */
button, a {
    transition: transform 0.15s ease, opacity 0.15s ease;
}
button:active, a:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Keyframes */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25%); }
}

@keyframes unlockScreen {
    from { 
        transform: translateY(0);
        opacity: 1;
    }
    to { 
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

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

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

@keyframes scaleIn {
    from { 
        transform: scale(0.8);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes pulseRed {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}