/* Reset Styles */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  font-style: italic;
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 1rem;
}
/* Import style guide variables */
:root {
  /* Colors from style-guide */
  --color-blue-1: #006895;
  --color-blue-2: #0899ba;
  --color-blue-3: #20a6b0;
  --color-teal: #8ec1b8;
  --color-beige: #dfdcd3;
  --color-white: #ffffff;
  --color-black: #000000;
  --color-ubuntu-orange: #ea5321;

  /* Semantic Colors */
  --color-primary: var(--color-blue-1);
  --color-secondary: var(--color-beige);
  --color-success: #20a6b0;
  --color-error: #dc3545;
  --color-warning: var(--color-ubuntu-orange);
  --color-info: var(--color-blue-2);
}

/* Main Styles */
main {
    font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-white);
    color: var(--color-black);
    line-height: 1.3;
    width: 400px;
    margin: 0 auto;
}

section {
    background: var(--color-white);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header {
    background: var(--color-primary);
    color: var(--color-white);
    text-align: center;
    padding: .4rem;
    font-weight: bold;
}

.main-wrapper {
    padding: 1rem;
}

#tips {
    display: none;
    width: 368px;
    position: absolute;
    background-color: var(--color-secondary);
    border: 1px solid var(--color-secondary);
}

#tips ul {
    list-style-type: disc;
    padding-bottom:.5rem;
    margin: .5rem 0 .1rem 2rem;
}

#tips ul li::marker {
  color: var(--color-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: bold;
}

textarea {
    width: 95%;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid var(--color-secondary);
    border-radius: 3px;
    resize: vertical;
}

#preview {
    margin-top: 1rem;
}

#previewText {
    background: var(--color-secondary);
    padding: 1rem;
    white-space: pre-wrap;
    border: 1px solid var(--color-secondary);
    border-radius: 3px;
    min-height: 100px;
}

#copyBtn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#copyBtn:hover {
    background: var(--color-blue-3);
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

#saveBtn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-success);
    color: var(--color-white);
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#saveBtn:hover {
    background: var(--color-teal);
}

#deleteBtn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-error);
    color: var(--color-white);
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#deleteBtn:hover {
    background: #ba2c37;
}

#deleteBtn:disabled {
    background: var(--color-secondary);
    cursor: not-allowed;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--color-white);
    border-left: 4px solid var(--color-primary);
    border-radius: 3px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-error); }
.toast.warning { border-left-color: var(--color-warning); }

@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(400px); opacity: 0; } }

.toast.removing { animation: slideOut 0.3s ease-in; }

/* Modal Dialog */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden { display: none; }

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    background: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-secondary);
}

.modal-header h3 {
    margin: 0;
    color: var(--color-black);
    font-size: 1.25rem;
}

.modal-body {
    padding: 1rem;
    color: var(--color-black);
}

.modal-body p { margin: 0; }

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-secondary);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-footer button { margin: 0; }

/* Modal Code Block */
.modal-code-block {
    background: var(--color-secondary);
    padding: var(--space-md);
    border-radius: var(--border-radius-md);
    margin: var(--space-md) 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Modal Form Input */
.modal-body input {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--color-secondary);
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 149, 0.1);
}

.modal-body .form-group {
    margin-bottom: var(--space-md);
}

.modal-body .form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: normal;
    color: var(--color-black);
}

/* Inline Save Form */
.save-prompt-form {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--color-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--color-secondary);
}

.save-prompt-form.hidden { display: none; }

.save-prompt-form .form-group { margin-bottom: 1rem; }

.save-prompt-form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-secondary);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

.save-prompt-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 149, 0.1);
}

.warning-message {
    color: var(--color-warning);
    font-size: 0.875rem;
    padding: 0.5rem;
    background: rgba(234, 83, 33, 0.1);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.warning-message.hidden { display: none; }

/* Button Variants */
.btn-confirm {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-success);
    color: var(--color-white);
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-confirm:hover { background: var(--color-teal); }

.btn-cancel {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-secondary);
    color: var(--color-black);
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
}

.btn-cancel:hover { background: #e8e5dc; }

.btn-secondary {
    margin-top: 0;
    padding: 0.5rem 1rem;
    background: var(--color-secondary);
    color: var(--color-black);
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
}

.btn-secondary:hover { background: #e8e5dc; }

.btn-danger {
    margin-top: 0;
    padding: 0.5rem 1rem;
    background: var(--color-error);
    color: var(--color-white);
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-danger:hover { background: #ba2c37; }

.hidden { display: none !important; }