diff --git "a/app.py" "b/app.py" --- "a/app.py" +++ "b/app.py" @@ -126,301 +126,301 @@ def update_last_seen(data, username): # Updated base style BASE_STYLE = ''' - :root { - --primary: #ff4d6d; /* Vivid pink-red */ - --secondary: #00ddeb; /* Bright cyan */ - --accent: #8b5cf6; /* Electric purple */ - --background-light: #fef9f1; /* Soft cream */ - --background-dark: #1f1a44; /* Deep indigo */ - --card-bg-light: rgba(255, 255, 255, 0.95); - --card-bg-dark: rgba(50, 45, 80, 0.95); - --text-light: #2a1e5a; - --text-dark: #e8e1ff; - --shadow: 0 10px 30px rgba(0, 0, 0, 0.2); - --glass-bg: rgba(255, 255, 255, 0.15); - --transition: all 0.4s ease-in-out; - --online: #34c759; /* Green for online */ - --offline: #ff3b30; /* Red for offline */ - } - * { margin: 0; padding: 0; box-sizing: border-box; } - body { - font-family: 'Inter', sans-serif; - background: var(--background-light); - color: var(--text-light); - line-height: 1.8; - transition: var(--transition); - overflow-x: hidden; - } - body.dark { - background: var(--background-dark); - color: var(--text-dark); - } +:root { + --primary: #ff4d6d; /* Vivid pink-red */ + --secondary: #00ddeb; /* Bright cyan */ + --accent: #8b5cf6; /* Electric purple */ + --background-light: #fef9f1; /* Soft cream */ + --background-dark: #1f1a44; /* Deep indigo */ + --card-bg-light: rgba(255, 255, 255, 0.95); + --card-bg-dark: rgba(50, 45, 80, 0.95); + --text-light: #2a1e5a; + --text-dark: #e8e1ff; + --shadow: 0 10px 30px rgba(0, 0, 0, 0.2); + --glass-bg: rgba(255, 255, 255, 0.15); + --transition: all 0.4s ease-in-out; + --online: #34c759; /* Green for online */ + --offline: #ff3b30; /* Red for offline */ +} +* { margin: 0; padding: 0; box-sizing: border-box; } +body { + font-family: 'Inter', sans-serif; + background: var(--background-light); + color: var(--text-light); + line-height: 1.8; + transition: var(--transition); + overflow-x: hidden; +} +body.dark { + background: var(--background-dark); + color: var(--text-dark); +} +.sidebar { + position: fixed; + top: 0; + left: 0; + width: 300px; + height: 100%; + background: var(--glass-bg); + backdrop-filter: blur(20px); + padding: 30px 20px; + box-shadow: var(--shadow); + z-index: 1000; + transform: translateX(0); + transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); +} +.sidebar.hidden { + transform: translateX(-100%); +} +.sidebar-header { + display: flex; + align-items: center; + gap: 15px; + margin-bottom: 40px; +} +.nav-brand { + font-size: 1.8em; + font-weight: 900; + background: linear-gradient(135deg, var(--primary), var(--accent)); + -webkit-background-clip: text; + color: transparent; +} +.logo { + width: 40px; + height: 40px; + border-radius: 14px; + box-shadow: var(--shadow); +} +.nav-links { + display: flex; + flex-direction: column; + gap: 18px; +} +.nav-link { + display: flex; + align-items: center; + gap: 15px; + padding: 15px 25px; + background: var(--card-bg-light); + color: var(--text-light); + text-decoration: none; + border-radius: 14px; + font-size: 1.1em; + font-weight: 600; + transition: var(--transition); + position: relative; +} +body.dark .nav-link { + background: var(--card-bg-dark); + color: var(--text-dark); +} +.nav-link:hover { + transform: translateX(5px); + background: var(--primary); + color: white; + box-shadow: 0 6px 20px rgba(255, 77, 109, 0.4); +} +.nav-link .badge { + position: absolute; + right: 15px; + background: var(--secondary); + color: white; + padding: 4px 8px; + border-radius: 12px; + font-size: 0.8em; + font-weight: 700; +} +.logout-btn { + background: var(--secondary); + color: white; +} +.logout-btn:hover { + background: #00b8c5; +} +.menu-btn { + display: none; + font-size: 30px; + background: var(--glass-bg); + border: none; + color: var(--primary); + cursor: pointer; + position: fixed; + top: 20px; + left: 20px; + z-index: 1001; + padding: 12px; + border-radius: 50%; + box-shadow: var(--shadow); + transition: var(--transition); +} +.menu-btn:hover { + background: var(--primary); + color: white; +} +.container { + margin: 30px auto 30px 320px; + max-width: 1300px; + padding: 30px; + transition: var(--transition); +} +.btn { + padding: 14px 28px; + background: var(--primary); + color: white; + border: none; + border-radius: 14px; + cursor: pointer; + font-size: 1.1em; + font-weight: 700; + transition: var(--transition); + display: inline-flex; + align-items: center; + gap: 10px; + box-shadow: var(--shadow); +} +.btn:hover { + transform: scale(1.05); + background: #e6415f; + box-shadow: 0 8px 30px rgba(255, 77, 109, 0.5); +} +input, textarea, select { + width: 100%; + padding: 14px; + margin: 14px 0; + border: none; + border-radius: 14px; + background: var(--glass-bg); + color: var(--text-light); + font-size: 1.1em; + transition: var(--transition); + box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.05); +} +body.dark input, body.dark textarea, body.dark select { + color: var(--text-dark); +} +input:focus, textarea:focus, select:focus { + outline: none; + background: rgba(255, 255, 255, 0.2); + box-shadow: 0 0 0 4px var(--primary); +} +.modal { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.85); + z-index: 2000; + justify-content: center; + align-items: center; + transition: opacity 0.4s ease; +} +.modal img, .modal video { + max-width: 95%; + max-height: 95%; + object-fit: contain; + border-radius: 20px; + box-shadow: var(--shadow); + animation: zoomIn 0.4s ease; +} +.theme-toggle { + position: fixed; + top: 20px; + right: 20px; + background: var(--glass-bg); + border: none; + padding: 12px; + border-radius: 50%; + cursor: pointer; + font-size: 24px; + box-shadow: var(--shadow); + transition: var(--transition); +} +.theme-toggle:hover { + transform: rotate(180deg); + background: var(--accent); + color: white; +} +.status-dot { + width: 10px; + height: 10px; + border-radius: 50%; + display: inline-block; + margin-left: 5px; +} +.online { + background: var(--online); +} +.offline { + background: var(--offline); +} +@keyframes zoomIn { + from { opacity: 0; transform: scale(0.9); } + to { opacity: 1; transform: scale(1); } +} +@media (max-width: 900px) { .sidebar { - position: fixed; - top: 0; - left: 0; - width: 300px; - height: 100%; - background: var(--glass-bg); - backdrop-filter: blur(20px); - padding: 30px 20px; - box-shadow: var(--shadow); - z-index: 1000; - transform: translateX(0); - transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); - } - .sidebar.hidden { + width: 100%; + max-width: 300px; transform: translateX(-100%); } - .sidebar-header { - display: flex; - align-items: center; - gap: 15px; - margin-bottom: 40px; - } - .nav-brand { - font-size: 1.8em; - font-weight: 900; - background: linear-gradient(135deg, var(--primary), var(--accent)); - -webkit-background-clip: text; - color: transparent; - } - .logo { - width: 40px; - height: 40px; - border-radius: 14px; - box-shadow: var(--shadow); - } - .nav-links { - display: flex; - flex-direction: column; - gap: 18px; - } - .nav-link { - display: flex; - align-items: center; - gap: 15px; - padding: 15px 25px; - background: var(--card-bg-light); - color: var(--text-light); - text-decoration: none; - border-radius: 14px; - font-size: 1.1em; - font-weight: 600; - transition: var(--transition); - position: relative; - } - body.dark .nav-link { - background: var(--card-bg-dark); - color: var(--text-dark); - } - .nav-link:hover { - transform: translateX(5px); - background: var(--primary); - color: white; - box-shadow: 0 6px 20px rgba(255, 77, 109, 0.4); - } - .nav-link .badge { - position: absolute; - right: 15px; - background: var(--secondary); - color: white; - padding: 4px 8px; - border-radius: 12px; - font-size: 0.8em; - font-weight: 700; - } - .logout-btn { - background: var(--secondary); - color: white; - } - .logout-btn:hover { - background: #00b8c5; + .sidebar.active { + transform: translateX(0); } .menu-btn { - display: none; - font-size: 30px; - background: var(--glass-bg); - border: none; - color: var(--primary); - cursor: pointer; - position: fixed; - top: 20px; - left: 20px; - z-index: 1001; - padding: 12px; - border-radius: 50%; - box-shadow: var(--shadow); - transition: var(--transition); - } - .menu-btn:hover { - background: var(--primary); - color: white; + display: block; } .container { - margin: 30px auto 30px 320px; - max-width: 1300px; - padding: 30px; - transition: var(--transition); - } - .btn { - padding: 14px 28px; - background: var(--primary); - color: white; - border: none; - border-radius: 14px; - cursor: pointer; - font-size: 1.1em; - font-weight: 700; - transition: var(--transition); - display: inline-flex; - align-items: center; - gap: 10px; - box-shadow: var(--shadow); - } - .btn:hover { - transform: scale(1.05); - background: #e6415f; - box-shadow: 0 8px 30px rgba(255, 77, 109, 0.5); - } - input, textarea, select { - width: 100%; - padding: 14px; - margin: 14px 0; - border: none; - border-radius: 14px; - background: var(--glass-bg); - color: var(--text-light); - font-size: 1.1em; - transition: var(--transition); - box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.05); - } - body.dark input, body.dark textarea, body.dark select { - color: var(--text-dark); - } - input:focus, textarea:focus, select:focus { - outline: none; - background: rgba(255, 255, 255, 0.2); - box-shadow: 0 0 0 4px var(--primary); - } - .modal { - display: none; - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(0, 0, 0, 0.85); - z-index: 2000; - justify-content: center; - align-items: center; - transition: opacity 0.4s ease; - } - .modal img, .modal video { - max-width: 95%; - max-height: 95%; - object-fit: contain; - border-radius: 20px; - box-shadow: var(--shadow); - animation: zoomIn 0.4s ease; + margin: 80px 15px 30px 15px; + max-width: calc(100% - 30px); } .theme-toggle { - position: fixed; - top: 20px; - right: 20px; - background: var(--glass-bg); - border: none; - padding: 12px; - border-radius: 50%; - cursor: pointer; - font-size: 24px; - box-shadow: var(--shadow); - transition: var(--transition); - } - .theme-toggle:hover { - transform: rotate(180deg); - background: var(--accent); - color: white; - } - .status-dot { - width: 10px; - height: 10px; - border-radius: 50%; - display: inline-block; - margin-left: 5px; - } - .online { - background: var(--online); + top: 80px; + right: 15px; } - .offline { - background: var(--offline); + .post-grid { + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } - @keyframes zoomIn { - from { opacity: 0; transform: scale(0.9); } - to { opacity: 1; transform: scale(1); } +} +@media (max-width: 480px) { + .nav-brand { + font-size: 1.5em; } - @media (max-width: 900px) { - .sidebar { - width: 100%; - max-width: 300px; - transform: translateX(-100%); - } - .sidebar.active { - transform: translateX(0); - } - .menu-btn { - display: block; - } - .container { - margin: 80px 15px 30px 15px; - max-width: calc(100% - 30px); - } - .theme-toggle { - top: 80px; - right: 15px; - } - .post-grid { - grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); - } + .nav-link { + font-size: 1em; + padding: 12px 20px; } - @media (max-width: 480px) { - .nav-brand { - font-size: 1.5em; - } - .nav-link { - font-size: 1em; - padding: 12px 20px; - } - .btn { - padding: 12px 20px; - font-size: 1em; - } + .btn { + padding: 12px 20px; + font-size: 1em; } +} ''' NAV_HTML = ''' - + ''' # Registration @@ -457,93 +457,93 @@ def register(): is_online = is_user_online(data, username) if is_authenticated else False html = ''' - - -
- - - - -{{ post['description'] }}
-By: {{ post['uploader'] }} | {{ post['upload_date'] }}
-Views: {{ post['views'] }} | Likes: {{ post['likes']|length }}
- - {% endfor %} -{{ post['description'] }}
+By: {{ post['uploader'] }} | {{ post['upload_date'] }}
+Views: {{ post['views'] }} | Likes: {{ post['likes']|length }}
+ + {% endfor %}{{ post['description'] }}
-By: {{ post['uploader'] }} | {{ post['upload_date'] }}
-Views: {{ post['views'] }} | Likes: {{ post['likes']|length }}
- {% if is_authenticated %} - - - {% endif %} -Login to like and comment.
- {% endif %} -
{{ comment['user'] }} ({{ comment['date'] }}): {{ comment['text'] }}
-