@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 50%, #2a2a2a 100%);
    min-height: 100vh;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(80, 80, 80, 0.1) 0%, transparent 50%);
    animation: pulse 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.3; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 0.5; }
}

.container {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==================== HEADER ==================== */

header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(42, 42, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(100, 100, 100, 0.3);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-info {
    padding: 0.5rem 1rem;
    background: rgba(80, 80, 80, 0.4);
    border-radius: 8px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #5a5a5a, #6a6a6a);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #8B1538, #a01848);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #a01848, #b02058);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* ==================== MAIN & VIEWS ==================== */

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.view {
    display: none;
    width: 100%;
    max-width: 1400px;
    animation: fadeIn 0.5s ease-out;
}

.view.active {
    display: block;
}

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

/* ==================== LOGIN VIEW ==================== */

.login-container {
    max-width: 450px;
    margin: 0 auto;
    background: rgba(50, 50, 50, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    border: 1px solid rgba(100, 100, 100, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: 600;
    color: #ffffff;
}

.totp-description {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ==================== FORM ELEMENTS ==================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1.125rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 1rem;
    color: white;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #888888;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(136, 136, 136, 0.2);
}

.form-group textarea {
    resize: vertical;
    font-family: 'Courier New', Monaco, monospace;
    line-height: 1.6;
    tab-size: 4;
    white-space: pre-wrap;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.error-message {
    color: #ff6b6b;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: #51cf66;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(81, 207, 102, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(81, 207, 102, 0.3);
}

/* ==================== LINKS VIEW ==================== */

.links-container {
    background: rgba(50, 50, 50, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.links-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
}

.category-nav {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.category-btn.active {
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    border-color: #666666;
    color: white;
}

.links-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.link-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.link-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(150, 150, 150, 0.4);
    transform: translateY(-2px);
}

.link-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.link-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.link-card-url {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    word-break: break-all;
}

.link-card-url:hover {
    color: #cccccc;
}

.link-card-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.link-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.link-info-label {
    color: rgba(255, 255, 255, 0.6);
}

.link-info-value {
    color: #ffffff;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.copy-btn:hover {
    color: #ffffff;
}

.link-notes {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-line;
    font-family: inherit;
    line-height: 1.8;
}

/* Summernote editor styling for dark theme */
.note-editor.note-frame {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #1a1a2e;
}

.note-editor .note-toolbar {
    background: #16213e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.note-editor .note-editing-area .note-editable {
    background: white;
    color: black;
}

/* Rich text content styling */
.memo-html-content {
    white-space: normal !important;
}

.memo-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(255, 255, 255, 0.05);
}

.memo-html-content table td,
.memo-html-content table th {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: left;
}

.memo-html-content table th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.memo-html-content p {
    margin: 0.5rem 0;
}

.memo-html-content ul,
.memo-html-content ol {
    margin: 0.5rem 0;
    padding-left: 2rem;
}

.memo-html-content li {
    margin: 0.25rem 0;
}

.memo-html-content strong {
    font-weight: 600;
    color: #ffffff;
}

.memo-html-content em {
    font-style: italic;
}

.memo-html-content u {
    text-decoration: underline;
}

.memo-html-content h1,
.memo-html-content h2,
.memo-html-content h3,
.memo-html-content h4,
.memo-html-content h5,
.memo-html-content h6 {
    margin: 1rem 0 0.5rem 0;
    color: #ffffff;
    font-weight: 600;
}

.memo-toggle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
    user-select: none;
}

.link-card-header:hover .memo-toggle {
    color: rgba(255, 255, 255, 0.9);
}

.memo-content {
    animation: slideDown 0.3s ease-out;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* ==================== PROFILE VIEW ==================== */

.settings-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(50, 50, 50, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.settings-container h2 {
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
}

.settings-container h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: rgba(80, 80, 80, 0.3);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.info-card h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-card p {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
}

.section-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.qr-code-container {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin: 1.5rem 0;
}

.qr-code-container img {
    max-width: 256px;
    border-radius: 10px;
    background: white;
    padding: 1rem;
}

.secret-code {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    word-break: break-all;
}

/* ==================== MANAGE VIEW ==================== */

.manage-container {
    background: rgba(50, 50, 50, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.manage-container h2 {
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
}

.manage-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    color: #ffffff;
    border-bottom-color: #888888;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tab-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.manage-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.manage-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.manage-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(150, 150, 150, 0.4);
}

.manage-item-info {
    flex: 1;
}

.manage-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.manage-item-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.manage-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== MODALS ==================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
}

.modal-overlay.show {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(50, 50, 50, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(100, 100, 100, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.show {
    display: block;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-actions .btn {
    flex: 1;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .links-content {
        grid-template-columns: 1fr;
    }

    .manage-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .manage-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal {
        width: 95%;
        padding: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
    }
}
