:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --text-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Dynamic Background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(45deg, #1cb5e0 0%, #000851 100%);
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    z-index: -2;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.bg-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(50px);
    z-index: -1;
    display: none;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
    margin: 0.5rem 2rem;
    height: 50px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    gap: 1rem;
}

.icon-btn,
.login-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.icon-btn:hover,
.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2.5rem;
    padding-bottom: 140px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Search Bar */
.search-container {
    width: 60%;
    max-width: 600px;
    height: 46px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 23px;
    transition: transform 0.2s;
}

.search-container:focus-within {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.25);
}

.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    margin: 0 1rem;
    outline: none;
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* Swiper */
.swiper {
    width: 100%;
    height: auto;
    min-height: 100%;
    position: relative;
    padding-bottom: 140px;
}

.swiper-pagination {
    bottom: 110px !important;
}

.swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}

.swiper-pagination-bullet-active {
    background: #0084ff !important;
}

.swiper-slide {
    display: flex;
    justify-content: center;
    padding: 0 2rem;
}

/* Page 1 Layout */
.widgets-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Reduced gap between widgets and grid */
}

/* Top Widgets Layout */
.top-widgets {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    margin-bottom: 0.2rem;
    padding: 0 1rem;
}

.widget-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.widget-card {
    width: 160px;
    height: 160px;
    border-radius: 24px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.widget-label {
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Weather Card Specifics */
.weather-card {
    background: rgba(52, 73, 94, 0.75);
    /* Dark Slate Blue */
    color: white;
    border: none;
    align-items: flex-start;
}

.weather-top h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.weather-top h1 {
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1;
}

.weather-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

#w-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.weather-desc {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.2;
}

/* Calendar Card Specifics */
.calendar-card {
    background: rgba(230, 230, 250, 0.25);
    /* Light Lavender Glass */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #333;
    /* Dark text for light bg? Screenshot has dark text on light bg */
    padding: 1rem;
}

/* Screenshot shows Dark text on Calendar? 
   Wait, screenshot "Calendar" text is dark grey/black.
   Background is whitish.
*/
.calendar-card {
    color: #2c3e50;
    justify-content: flex-start;
    padding: 0.6rem;
    background: linear-gradient(135deg, rgba(230, 230, 250, 0.8), rgba(255, 255, 255, 0.4));
}

.cal-header {
    margin-bottom: 5px;
}

#cal-month {
    color: #ff3b30;
    /* iOS Red */
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    width: 100%;
    font-size: 0.75rem;
    text-align: center;
}

.cal-day-name {
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 2px;
}

.cal-day {
    width: 17px;
    height: 17px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin: 0 auto;
}

.cal-day.today {
    background: #ff3b30;
    color: white;
    font-weight: bold;
}

/* App Grid (iOS Style) */
.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1.2rem 0.5rem;
    padding: 0.1rem 0;
    width: 100%;
    align-content: start;
}

.app-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-decoration: none;
    color: white;
    gap: 0.5rem;
    transition: transform 0.2s;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    position: relative;
    /* For delete button */
}

.app-item:hover {
    transform: scale(1.05);
}

/* App Icon Style (Refined Squircle) */
.app-icon {
    width: 65px;
    height: 65px;
    border-radius: 22.5%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Folder 9-Grid Preview */
.folder-icon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.25) !important;
}

.mini-icon-box {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
}

.mini-icon-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Edit Mode Styles */
.app-item.wiggle {
    animation: wiggle 0.3s ease-in-out infinite;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(-2deg);
    }

    50% {
        transform: rotate(2deg);
    }
}

.delete-btn {
    position: absolute;
    top: -5px;
    left: -5px;
    z-index: 10;
    color: #ff3b30;
    font-size: 1.2rem;
    cursor: pointer;
    background: white;
    border-radius: 50%;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.add-btn-item .app-icon {
    cursor: pointer;
    transition: background 0.3s;
}

.add-btn-item .app-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

.app-item span {
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
}

.modal {
    width: 90%;
    max-width: 400px;
    background: rgba(20, 20, 20, 0.8);
    padding: 2rem;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.input-group input {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    outline: none;
    font-size: 16px;
}

.icon-selector {
    display: flex;
    gap: 0.5rem;
}

.icon-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
}

.icon-option.selected {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.save-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(45deg, #2196F3, #21CBF3);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

/* Bottom Dock */
.bottom-dock-container {
    position: fixed;
    bottom: 3.5rem;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 100;
}

.bottom-dock {
    width: auto;
    min-width: 200px;
    max-width: 650px;
    height: 85px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    padding: 0 1.5rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

.bottom-dock .app-item span {
    display: none;
    /* Hide names in dock for clean iOS look */
}

/* Placeholder Style (Match Image 1) */
.placeholder-icon {
    border: 2px dashed rgba(255, 255, 255, 0.4) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: white;
    font-size: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.placeholder-icon i {
    opacity: 0.8;
}

/* Folder Modal */
.folder-modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.folder-view {
    width: 95%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    /* Heavy frosted glass */
    -webkit-backdrop-filter: blur(40px);
    border-radius: 40px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transform: scale(0.85);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .folder-view {
    transform: scale(1);
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.folder-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    /* 4x3 as requested */
    gap: 1.5rem 1rem;
    min-height: 300px;
}

/* Remove unused Page 2 & 3 styles */
/* Page 2 & 3 hidden */
.page-container,
.two-columns,
.four-columns,
.rss-widget,
.group-widget {
    display: none;
}

.icp-footer {
    position: fixed;
    bottom: 8px;
    width: 100%;
    text-align: center;
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
    z-index: 50;
    font-weight: 500;
}

.icp-footer a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.icp-footer a:hover {
    color: rgba(0, 0, 0, 0.9);
}